How to use backspace key to clear listbox so you can enter in a new value

  • Thread starter Thread starter dman19
  • Start date Start date
D

dman19

Guest
I am making a multiplication chart that when you hit display it will show in a list box the number from the text box mutiplied by numbers 1-9, but i am having the problem that if i hit backspace and enter a new number it will not clear the old list and put the new list in the box. I have looked around and tried to figure out how to code it to refresh the list when hitting the display button again but i dont know how to so any help would be much appreciated.

Private Sub DisplayButton_Click(sender As Object, e As EventArgs) Handles DisplayButton.Click
Do While (num <= 9)
ListBox.Items.Add(Val(NumbertxtBox.Text) & "*" & num & "=" & num * Val(NumbertxtBox.Text))
num += 1
ListBox.Refresh()
Loop

If Integer.TryParse(NumbertxtBox.Text, num) Then

Else
MessageBox.Show("Please Enter a Number")
End If



End Sub
End Class

Continue reading...
 
Back
Top