EDN Admin
Well-known member
<pre class="prettyprint lang-vb im trying to create an random name getter. the user should add 10 names into 10 textboxes then the names will be send to an arraylist after that is completed the program should pick 3 random names and print them in an multiline textbox as: number1: (name1) number2: (name2) number 3: (name 3) this is my code so far but im stuck now Imports System.Collections
Imports System
Imports Microsoft.VisualBasic
Public Class Form1
Dim tmeNow As DateTime = DateTime.Now
Dim mls As Integer = tmeNow.Millisecond
Dim rndNumber As Random = New Random(mls)
Dim name1 As ArrayList
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
name1.Add(TextBox1.Text)
name1.Add(TextBox2.Text)
name1.Add(TextBox3.Text)
name1.Add(TextBox4.Text)
name1.Add(TextBox5.Text)
name1.Add(TextBox6.Text)
name1.Add(TextBox7.Text)
name1.Add(TextBox8.Text)
name1.Add(TextBox9.Text)
name1.Add(TextBox10.Text)
Dim NewNumber1 As Integer = rndNumber.Next(0, 9)
Dim NewNumber2 As Integer = rndNumber.Next(0, 9)
Dim NewNumber3 As Integer = rndNumber.Next(0, 9)
Dim num1 As String = name1.IndexOf(NewNumber1.ToString)
Dim num2 As String = name1.IndexOf(NewNumber2.ToString)
Dim num3 As String = name1.IndexOf(NewNumber3.ToString)
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
End Sub
End Class [/code]
<br/>
<br/>
View the full article
Imports System
Imports Microsoft.VisualBasic
Public Class Form1
Dim tmeNow As DateTime = DateTime.Now
Dim mls As Integer = tmeNow.Millisecond
Dim rndNumber As Random = New Random(mls)
Dim name1 As ArrayList
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
name1.Add(TextBox1.Text)
name1.Add(TextBox2.Text)
name1.Add(TextBox3.Text)
name1.Add(TextBox4.Text)
name1.Add(TextBox5.Text)
name1.Add(TextBox6.Text)
name1.Add(TextBox7.Text)
name1.Add(TextBox8.Text)
name1.Add(TextBox9.Text)
name1.Add(TextBox10.Text)
Dim NewNumber1 As Integer = rndNumber.Next(0, 9)
Dim NewNumber2 As Integer = rndNumber.Next(0, 9)
Dim NewNumber3 As Integer = rndNumber.Next(0, 9)
Dim num1 As String = name1.IndexOf(NewNumber1.ToString)
Dim num2 As String = name1.IndexOf(NewNumber2.ToString)
Dim num3 As String = name1.IndexOf(NewNumber3.ToString)
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
End Sub
End Class [/code]
<br/>
<br/>
View the full article