Monday, December 21, 2009

In Visual Basic, how do I list all the numbers between two numbers in ascending order?

For example, if I type in the numbers 3 and 8, how can I click a button that will then execute the numbers 3,4,5,6,7,8?In Visual Basic, how do I list all the numbers between two numbers in ascending order?
Copy and paste into code pane.


I used VB6.





Dim SNumber, ENumber, INumber As Integer


Private Sub Command1_Click()





SNumber = CInt(Text1.Text)


ENumber = CInt(Text2.Text)





For INumber = SNumber To ENumber Step 1


List1.AddItem (INumber)


Next INumber





End Sub


'''Reset


Private Sub Command2_Click()


Text1.Text = ';';


Text2.Text = ';';


List1.Clear


End Sub





Private Sub Form_Load()


Text1.Text = ';';


Text2.Text = ';';


End Sub





: )


In Visual Basic, how do I list all the numbers between two numbers in ascending order?
something like this





input a, b





for x = a to b


print x


next x
just use forloop ..........
  • myspace.com social network
  • No comments:

    Post a Comment