Show information from the selected item in a ListBox to an other form

  • Thread starter Thread starter iDesmet
  • Start date Start date
I

iDesmet

Hallo,

I have 2 forms. In one form (let's call it frmClient) I have
textboxes, comboboxes, etc in which I can save/update information to a
database (MySQL to be more exactly).

The other form (frmClientBrowser) shows the information saved in the
database in a ListBox. In this form I have three buttons, one button
(btnAdd) display the frmClient form with no values in the controls (I
just call the form), the second button (btnEdit) should display the
information to edit from the selected item in the ListBox.

The question is: How do I fill the information to the controls in the
frmClient form from the selected item in the ListBox from the
frmClientBrowse form so I can only edit the information I want?

I'm using VB.NET

Thanks in advance.

PS My apologies for my bad english.

Best Regards,
David Desmet
 
Hallo,

I have 2 forms. In one form (let's call it frmClient) I have
textboxes, comboboxes, etc in which I can save/update information to a
database (MySQL to be more exactly).

The other form (frmClientBrowser) shows the information saved in the
database in a ListBox. In this form I have three buttons, one button
(btnAdd) display the frmClient form with no values in the controls (I
just call the form), the second button (btnEdit) should display the
information to edit from the selected item in the ListBox.

The question is: How do I fill the information to the controls in the
frmClient form from the selected item in the ListBox from the
frmClientBrowse form so I can only edit the information I want?

I'm using VB.NET

Thanks in advance.

PS My apologies for my bad english.

Best Regards,
David Desmet

Generally, when communicating across forms my preferred method is to
have the first form fire an event that the second form can listen to.
In your case I would recommend creating a custom EventArgs class that
will hold the data the second form needs and create a custom event to
use that EventArgs class.

If you need help on wiring up the events, a quick search on Google
should provide several good links. If you have any further questions
you can't find on Google, please ask again here and I (or others) will
try to help out.

Thanks,

Seth Rowe [MVP]
 
Generally, when communicating across forms my preferred method is to
have the first form fire an event that the second form can listen to.
In your case I would recommend creating a custom EventArgs class that
will hold the data the second form needs and create a custom event to
use that EventArgs class.

If you need help on wiring up the events, a quick search on Google
should provide several good links. If you have any further questions
you can't find on Google, please ask again here and I (or others) will
try to help out.

Thanks,

Seth Rowe [MVP]

Seth,

Thank you very much for your quick reply! I'll try that. I'm searching
on Google right now...

In case I can't achieve what I want to do, I'll ask again here.

Thanks again!

Best Regards,
David Desmet
 
Back
Top