I need to get the data from datagrid for the double clicked row into a new form, i’ve just dived into dotnet development, please guide the way to do.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First as Gapton said, you need to hand
CellDoubleClickevent and inside this event you can get current row’s cell values using following syntax:where
e.RowIndexis the index of row user double clicked on ande.ColumnIndexcontains the column index of cell for which this double click is occured…now, to pass values to new form, you can do this in two different ways:
1: using public properties, say you have Form2 to which you want to pass values, in Form2 class define properties for the values your are interested in such as:
and in your
CellDoubleClickabove, instantiate new object of Form2, assign values to properties and call show method to display this form:2: using overloaded constructor, write an overloaded constructor for Form2, like this:
and then in event handler: