Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
//In form 1
private void Review_Click(object sender, EventArgs e) 
{               
    NewReview form2 = new NewReview ();
          
    form2.ShowDialog();
} 

public class NewReview : Form //add new form
{
}


//Form 2

public partial class NewReview : Form
{
    DataTable ReviewA;


    public NewReview (DataTable ReviewB)
    {
        InitializeComponent();
        dataGrid1.DataSource = ReviewB;
        ReviewA= ReviewB;
    }
}
Posted
Updated 10-Aug-14 21:28pm
v2

1 solution

C#
//In Form1 Review_Click
DataTable dt = new DataTable
NewReview frmReview = new NewReview (dt ); // here you can pass your DataTable as argument
frmReview.ShowDialog();
//In Form2

public NewReview (DataTable ReviewB)
    {
        InitializeComponent();
        dataGrid1.DataSource = ReviewB;

    }
 
Share this answer
 
v3
Comments
mariana94 11-Aug-14 4:51am    
i got this Error "does not contain a constructor that takes '1' arguments" after i put some argument in NewReview frmReview = new NewReview (dt );. i kept having this error everytime i put some argument to call my constructor. i am sorry, i am newbie in this windows ce.
Dilan Shaminda 11-Aug-14 5:34am    
i think it is calling the public class NewReview : Form constructor
mariana94 11-Aug-14 21:25pm    
how? can u give me some example or any link?

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