Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to Add DataGridView in my User Control .so i want to create get or set method for DataGridView .
for Example if i add one text box in my user Control then if i want set or get property of text box so i write following code.here EmployeeFirstNametxt is text box name
so if possible for DataGridView then tell which way...

C#
public string EmployeeFirstName
        {
            get
            {
                return EmployeeFirstNametxt.Text;
            }
            set
            {
               EmployeeFirstNametxt.Text = value;
            }
        }
Posted
Updated 6-Aug-11 3:46am
v2

1 solution

What DataGridView properties are you wanting to expose?

You would expose them in the same way you did the EmployeeFirstNametxt.Text property,
for example to expose the DataGridViews DataSource property;

public object DataGridViewDataSource
{
    get { return dgv.DataSource; }
    set { dgv.DataSource = value; }
}
 
Share this answer
 
Comments
Dharmessh12 9-Aug-11 5:03am    
thanks for helping......

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