i need to look at information on the modal form based on what I clicked in the listbox....if I clicked a specific item then I want the form to load with that persons information loaded in the form...
Main Topics
Browse All Topicsi have a mdichild form with a data binded list box with several items...I would like the ability to click/doubleclick on an item and a modal dialogform appears...... by using the selectedindex of the listitem the information then poplulates the modal form for the user to view the deatils of the item
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
So, you could modify the code as such. After designing the modal form (Form2) with say 3 textboxes representing the user's First Name, Last Name & SSN.
dim f as new Form2
f.TextBox1.Text = Me.LabelFirstName.Text
f.TextBox2.Text = Me.LabelLastName.Text
f.TextBox3.Text = Me.LabelSSN.Text
f.ShowDialog()
Then, after the ShowDialog command, you can "retrieve" the modified values from the modal form like this:
Me.LabelFirstName.Text = f.TextBox1.Text
etc...
Does that make sense?
Business Accounts
Answer for Membership
by: kalliopiPosted on 2005-09-16 at 23:33:36ID: 14902959
To test your question I created a new Window Form (Form1), dropped a ListBox on it (ListBox1) and bound that to the Categories table in the Northwind Database. Then, in the Click event handler I put this code:
lue)
Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
MsgBox(ListBox1.SelectedVa
End Sub
That showed the CategoryID from the categories table in a Message Box. If you want to pop up a modal dialog box, just design a 2nd form (Form2) and then add THIS code to the Click Event
Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
dim f as new Form2
f.ShowDialog()
End Sub
Further, if on form2 you put 2 buttons, you can assign the DialogResult property of each button to be OK and Cancel respectively. Then, (event without any code under each of those buttons) they will both "close" the modal dialog. You can detect WHICH button was pushed, but modify your code slightly further like this:
Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
dim f as new Form2
if f.ShowDialog() = DialogResult.OK then
' They clicked OK - what do you want to do?
else
' They clicked Cancel - what do you want to do?
end if
End Sub
That's about it. Hope this is what you were looking for. Good luck.