When I click the Add button is saves the word entered to an array and then when Show is clicked it shows the words in the array. However if I enter 5 words and then click show it'll show the 5 words and then if I add another few words and click show it'll only show the few added words and not the 5 original words entered.
The array has a limit of 20 wordsCode:Public Class Form1 Dim wordList(19) As String Dim k As Integer Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click If k < 20 Then wordList(k) = txbWord.Text End If If k = 19 Then cmdAdd.Enabled = False End If k = k + 1 ' txbWord.Clear() ' doesnt include 20th word in list End Sub Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click lstBox.Items.Clear() Array.Sort(wordList) Dim i As Integer lstBox.Items.Add("Index Word") For i = 0 To wordList.GetUpperBound(0) lstBox.Items.Add(CStr(i+1) & " " & wordList(i)) Next End Sub




Reply With Quote