|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi all,
I want to know howto pass data between MDI childs. I have a childform (frmList) with a DataGridView on it. Now when I doubleclick on a row I want to open an other MDI child (frmDetails) with all the data from that DataGridViewRow I doubleclicked. How can I access the data in an other MDI child or pass it between them? Grts and thx for any help.. Pit76 ![]() |
|
#2
|
||||
|
||||
|
something like this:
Code:
protected void dataGridView_doubleclick (object sender, gridvieweventargs e)
{
int primaryKeyID = ........
((cast goes here)this.ParentForm).OpenSomeOtherForm(primaryKeyID);
}
basically you: 1. get the primary key id for the row clicked 2. Pass the primary key id to the MDI parent which then opens up a new MDI child 3. MDI child form then loads data based on the primary key id and whatever other data you pass to it |
|
#3
|
|||
|
|||
|
Thx but I am afraid I don't reallt get it
Code:
private void dataGridViewOverzichtArtikels_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
artTitelValue = dataGridViewOverzichtArtikels.Rows[e.RowIndex].Cells["ArtTitel"].Value.ToString();
artInhoudValue = dataGridViewOverzichtArtikels.Rows[e.RowIndex].Cells["ArtInhoud"].Value.ToString();
// Openen nieuw ArtikelBeheer formulier
FormArtikelBeheer _FormArtikelBeheer = new FormArtikelBeheer();
_FormArtikelBeheer.MdiParent = this.ParentForm;
_FormArtikelBeheer.Tag = 1;
_FormArtikelBeheer.Show();
}
This is what I have so far.. I made some Public Properties on the childform frmList wich will be filled with the data from the selected row in the datagrid. Then I open a new formArtikelBeheer. Now I don't get howto access the filled properties of the frmList through the other child formArtikelBeheer.. I have a problem with the casting.. Update: Only had to add this in the formArtikelBeheer: Code:
textBoxArtTitel .Text = ((FormArtikelOverzicht)MdiParent.MdiChildren[0]).ArtikelTitelDGV; I was so close, only I forgot the [0] Thx, Pit76 Last edited by Pit76 : May 2nd, 2008 at 05:41 PM. Reason: Update [solved] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Passing data between MDIchilds |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|