The document describes using an InputBox within a For loop in Visual BASIC .NET 2012. It shows code for a form with a text box, list box, and button. The code uses InputBox to prompt the user for a number, stores it in the list box, and totals the values entered over the number of iterations defined by the value in the text box. The loop will execute the number of times entered in the text box, displaying a running total of the input values.
1 of 3
Download to read offline
More Related Content
Part19 inputbox using for..loop
1. Visual BASIC .NET 2012
PART 19-INPUTBOX USING FOR..LOOP
Dr. GIRIJA NARASIMHAN 1
This slides are available http://slideshare.net /nbgirija
2. Dr. GIRIJA NARASIMHAN 2
This tutorial only for beginners , those
who don’t have any knowledge about
any programming language skill and
application design.
3. Dr.GIRIJA NARASIMHAN 3
Public Class Form5
Dim r As Integer
Dim s As Integer
Private Sub TextBox1_mouseclick(sender As Object, e As EventArgs) Handles TextBox1.Mouse
ListBox1.Enabled = True
Dim d As Integer
r = Val(TextBox1.Text)
MessageBox.Show("The loop will execute " & r & " times")
s = 0
For i As Integer = 1 To r
d = InputBox("enter the value " & i, "Enter values")
ListBox1.Items.Add(d)
s = s + d
Next i
MessageBox.Show("Total value entered = " & s)
ListBox1.Enabled = False
ListBox1.Items.Clear()
End Sub
End Class