Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i'm developing window based project in vs 2008. i've issues in forms with mdi forms. i'm developing INventory system project.In all forms running inside the mdiform. my client requesting some requirment in sales form. that's multiple sales forms at a time in a single machine.
ex: 1st customer --> Sysytem admin type 5 products--> customer need to buy another some items. so here the System admin need to Open another Sales form etc.

i tried this Code

VB
Dim frmSale = New frmSales
        frmSale.WindowState = FormWindowState.Normal
        frmSale.FormBorderStyle = FormBorderStyle.FixedSingle
       frmSales.Size = New Size(600, 500)
       frmSale.TopLevel = False
       frmSale.Parent = Me.pnlCon
       frmSale.Show()
       frmSale.BringToFront()


But its working. but inside the form i'm using gridview. i could not push the datas to Current dynamic form gridview and other fields.
Otherwords how to create existing form as multiple forms(multiple instances). how to set the values to newly created instances.

help me too fix this issue
Posted
Updated 30-Apr-14 3:47am
v2
Comments
[no name] 30-Apr-14 9:11am    
"i could not push the datas", what does that even mean? In the code you show here, you are not doing much of anything with frmSale... just displaying it.
johannesnestler 30-Apr-14 9:41am    
shouldn't it be frmSale.MdiParent (you said all forms are inside your MdiParent)? But anyway like Wes Aday I don't understand what you want, can you try to explain "better", and update your question?
[no name] 30-Apr-14 10:38am    
Pass the data to the new form in the form constructor.

1 solution

/////////u have tagged the question in c# and provided code block in VB ,below code is c#.if u r
//////////using VB change below code as per ur requirement

/////////create a global data table and set property in the parent
C#
DataTable _childGridDt = new DataTable();

////////////set property for the datatable in parent
C#
public DataTable ChildGridDt
{
    get { return _childGridDt ; }

}


/////////////in ur child form ie 'frmSales' create a global data table and set property
C#
DataTable _childGridDt = new DataTable();

      public DataTable ChildGridDt
      {
          get { return _childGridDt ; }
          set { _childGridDt = value; }
      }


//////////////when u call the form using object frmSale pass the data table value
VB
Dim frmSale = New frmSales

/////passing value to the object frmSale
VB
frmSale.ChildGridDt='your datatable from database';
 frmSale.WindowState = FormWindowState.Normal
frmSale.FormBorderStyle = FormBorderStyle.FixedSingle
frmSales.Size = New Size(600, 500)
 frmSale.TopLevel = False
 frmSale.Parent = Me.pnlCon
 frmSale.Show()
frmSale.BringToFront()


/////////////in the load section of 'frmSales', child form bind grid with datatable value
////////gridInfrmSales,grid in child form
C#
gridInfrmSales.Datasource=_childGridDt;


gudluck ;-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900