-
Is it possible to enter 2 numbers, say 100 and 300 and get vb to produce a list of the numbers and store them in a database
so if the user typed 100 as the lowest and 300 as the highest the program would put 100,101,102,103....300 into my database?
thanx in advance....
Rhys
-
Need to add validation yourself...
Code:
Dim lFrom as long, lTo as Long, l as Long
' check if values are entered
' code goes here
' read out entered values
lFrom = Clng(Val(Text1.Text))
lTo = Clng(Val(Text2.Text))
' validate if From < To
' code goes here
' loop from lFrom to lTo
For l = lFrom to lTo
' do something with l
' code for adding to database goes here
Next
-
Thanx but is there an easier way? anybody?
cheers though
Rhys
-
Crazy D's way is easiest.
here:
For n = 100 to 300
text1.text = text1.text & " " & n
next n
add the above code to a project then add a textbox and run. What will result will text1.text will have all the numbers from 100 to 300