English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to print the numbers 1 to 99.
i have written the following code:

private sub cmdCommand1_click()
dim i as integer
for i = 1 to 99
print i
next i
end sub

what's wrong with this coding??? The output of above is all the numbers from 1 to 16??????

2007-10-01 00:12:46 · 7 answers · asked by anmol_002 2 in Computers & Internet Programming & Design

7 answers

You are viewing the window in its default size and there is only room for the display to show the first 16 numbers. Maximize the window or start it full size and there will be more room to show additional lines that have been printed.

You may need to add code to scroll the window using a scroll bar control OR print to a list box which allows scrolling a longer list. Printing to a list box is really adding items to the listbox collection.

2007-10-01 01:41:52 · answer #1 · answered by MarkG 7 · 1 0

It looks like it should work, perhaps it is a screen size problem. Try putting a space after print I to seperate the numbers by a space instead of a carriage return, use a semi-colon after print i for no space, or a comma for a tab

private sub cmdCommand1_click()

dim i as integer

REM One Space only after print i
for i = 1 to 99
print i; " ";
next i
end sub



private sub cmdCommand1_click()

dim i as integer

REM One tab only after print i
for i = 1 to 99
print i,
next i
end sub

2007-10-01 00:25:40 · answer #2 · answered by Feeling Mutual 7 · 1 0

im not so sure but I think
you are printing on a form so you need to set the size of the form
or print them side by side

private sub cmdCommand1_click()
dim i as integer
for i = 1 to 99
print i & " " ;
if currentx >= height then
currenty = currenty + 10 ' value Depends on if you are using pixels inches or twips
end if


next i
end sub

2007-10-01 15:22:26 · answer #3 · answered by Anonymous · 0 0

I know nothing but I would have thought you would code it something like this

private sub cmdCommand1_click()
dim i as integer
for i = 1 to 99
print i
i=i+1
next i
end sub

If that works I'll eat my modem.
the fact that you are getting an output 1 to 16 suggests that you are operating in hex and of course 16 is 1 in hex. I am so far out of my depth now that my saliva is boiling due to brain overheat.

2007-10-01 00:24:21 · answer #4 · answered by Anonymous · 0 3

isnt it sql+ ???

private sub cmdCommand1_click()
dim i as integer
for i = 1 to 99;
print i;
i=i+1;
next i;
end sub

2007-10-01 00:56:11 · answer #5 · answered by Anonymous · 0 2

Do coding on Me.Resize Event, which will change the size of web browser as the size of form change. WebBrowser.Width= Me.ScaleWidth WebBrowser.Height= Me.ScaleHeight

2016-05-17 23:27:46 · answer #6 · answered by ? 3 · 0 0

try this
dim i as integer
if i<=99 then
i=i+1
print i
end sub
i like to share vb knowladge e-mail me for if you want to share knowladge
milandevmani321@yahoo.co.in

2007-10-01 00:48:23 · answer #7 · answered by Devmani milan 2 · 0 2

fedest.com, questions and answers