-
interaction between forms
hi,
i'm very new at .net and programming, kind of a hobby :-)
i have 2 forms:
a head form that has 3 listboxes and a button (the 3 listboxes load text from 3 text files)
a 'pop up' form that has 3 listboxes, 3 textboxes and 3 buttons
when i click the button on the head form the 'pop up' form pops up.
the 3 listboxes on the 'pop up' form are linked to those on the head form.
i added 3 button on the 'pop up' form:
an add button (which adds an item to the listbox via textbox)
a remove button (which removes a selected item of the listbox)
a clear all button (which clears all items of all listboxes)
each button also has a <me.close> so that the 'pop up' form closes again
everything works perfectly so far!
but now:
when i add an item to the listbox it appears, when i add another it appears also perfectly
when i remove an item it gets removed,
BUT then when i add another item i have a blank line first and then the item in my listbox on the head form!!
code of the pop up form (head form = form1):
Code:
'remove button':
Private Sub Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For i As Integer = 0 To ListBox1.Items.Count - 1
Next
ListBox1.Items.Remove(ListBox1.SelectedItem)
Form1.ListBox1.Items.Clear()
Form1.ListBox1.Items.AddRange(ListBox1.Items)
Me.Close()
End Sub
'add button':
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i As Integer = 0 To ListBox1.Items.Count - 1
Next
ListBox1.Items.Add(TextBox1.Text)
Form1.ListBox1.Items.Clear()
Form1.ListBox1.Items.AddRange(ListBox1.Items)
Me.Close()
End Sub
can anyone please help this newbie?
thx,
Eshaidu
Similar Threads
-
By scorpion83 in forum C++
Replies: 3
Last Post: 07-16-2009, 12:14 PM
-
By abhijava in forum Java
Replies: 4
Last Post: 08-02-2007, 06:29 AM
-
By Blitzfrit in forum Java
Replies: 4
Last Post: 06-18-2004, 08:12 AM
-
By Tengku in forum Database
Replies: 1
Last Post: 04-11-2001, 08:27 AM
-
By BradLey McKee in forum VB Classic
Replies: 1
Last Post: 05-29-2000, 10:51 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|