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

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
 
R

rowe_newsgroups

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]
 
I

iDesmet

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top