hello
i am new to dot net and i have a problem with this code below. what is expected is that the method should add the names in the string in random order into the listbox. but the output shows only single alphabets added rather than the whole name. i don't know where im wrong. can anyone correct me?
i am new to dot net and i have a problem with this code below. what is expected is that the method should add the names in the string in random order into the listbox. but the output shows only single alphabets added rather than the whole name. i don't know where im wrong. can anyone correct me?
VB.NET:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim fr(4) As String
fr(0) = "abba"
fr(1) = "dama"
fr(2) = "beta"
fr(3) = "elep"
fr(4) = "cat"
addrand(fr)
End Sub
Sub addrand(ByVal rand() As String)
Dim nofr As Integer = rand.Length - 1
Dim n As String
Dim Random As New System.Random()
For Each n In rand
Dim m As Integer = Random.Next(nofr)
ListBox3.Items.Add(n(m))
Next
End Sub