-
April 12th, 2011, 04:06 PM
#1
Multi Forms and List Boxes
Ok, Im having trouble passing a value from one form back to another using a listbox... The user clicks a button in the main form to bring up an instance of another form (form2.show). In that form, the user then then selects a number 1-5 and then presses done:
Code:
Private Sub frmPlayer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
If lboNumber.Items.Count = 0 Then 'list box is empty
For x = 1 To 5
lboNumber.Items.Add(x.ToString)
Next
End If
End Sub
How do I pass that value back to the main form as a value when the user clicks done?
-
April 12th, 2011, 04:29 PM
#2
Re: Multi Forms and List Boxes
Create a PUBLIC property, and you can call it from a different form. Not DIM'd
-
April 13th, 2011, 01:11 AM
#3
Re: Multi Forms and List Boxes
Simple, I'd set the Done button ( on the second form ) 's DialogResult property to OK, then show Form 2 with ShowDialog, as in :
Code:
Dim f2 As New Form2
If f2.ShowDialog() = Windows.Forms.DialogResult.OK Then
....
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
|
Click Here to Expand Forum to Full Width
|