|
-
Apr 4th, 2000, 04:37 PM
#1
Thread Starter
Junior Member
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
-
Apr 4th, 2000, 05:52 PM
#2
Hyperactive Member
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
-
Apr 4th, 2000, 06:31 PM
#3
Thread Starter
Junior Member
Thanx but is there an easier way? anybody?
cheers though
Rhys
-
Apr 4th, 2000, 06:43 PM
#4
So Unbanned
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|