.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old April 27th, 2008, 11:58 AM
Pit76 Pit76 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 Pit76 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 43 sec
Reputation Power: 0
Lightbulb Passing data between MDIchilds

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

Reply With Quote
  #2  
Old April 28th, 2008, 07:00 AM
danielk's Avatar
danielk danielk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Earth
Posts: 207 danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 23 h 20 m 15 sec
Reputation Power: 4
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

Reply With Quote
  #3  
Old May 2nd, 2008, 11:34 AM
Pit76 Pit76 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 Pit76 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 43 sec
Reputation Power: 0
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]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Passing data between MDIchilds


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway