Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim d As Integer = d.ToString() ListBox1.BeginUpdate() For d = 1 To 5 ListBox1.Items.Add(d) Next d ListBox1.EndUpdate() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim d As Integer = d.ToString() ListBox1.BeginUpdate() ListBox2.BeginUpdate() While ListBox1.SelectedItems.Count > 0 d = ListBox1.Items.Add(0) ListBox1.Items.Remove(d) ListBox2.Items.Add(d * d) ListBox1.EndUpdate() ListBox2.EndUpdate() End While End Sub End Class [\code] i want to create a two listbox with a button and i am doing is in the listbox have a value of loop 1 to 5 and then when i press the button ,in the listbox1 will go into listbox2 but it will multiply by itself ... my problem when i run my program and i press the button my program stock (form 1). [code] Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim d As Integer = d.ToString() ListBox1.BeginUpdate() For d = 1 To 5 ListBox1.Items.Add(d) Next d ListBox1.EndUpdate() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim d As Integer = d.ToString() ListBox1.BeginUpdate() ListBox2.BeginUpdate() While ListBox1.SelectedItems.Count > 0 d = ListBox1.Items.Add(0) ListBox1.Items.Remove(d) ListBox2.Items.Add(d * d) ListBox1.EndUpdate() ListBox2.EndUpdate() End While End Sub End Class
↧
please help me!
↧