Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, i have a datagrid view, in that im selecting a row or cell with mouse so that the data in the colums/row/cells are displaying in textboxes....

whatever the cell i click the entire data of row in datagrid is displaying in the textbox...
here what i want is , not only the mouse, but when every i press down arrow key or up arrow key in keyboar, i must select upper row or lower row and the data should display in the text boxes....

can u please help me in this logic....



the code i written to select and display in the textboxes is...
C#
private void cut_grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

            if (e.RowIndex >= 0)
            {
                cut_grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                DataGridViewRow row = this.cut_grid.Rows[e.RowIndex];
                cut_code.Text = row.Cells["Customer_Code"].Value.ToString();
                cut_name1.Text = row.Cells["Customer_Name"].Value.ToString();
                cut_name2.Text = row.Cells["Customer_Name2"].Value.ToString();
                iadd1.Text = row.Cells["Invoice_Address"].Value.ToString();
                iadd2.Text = row.Cells["Invoice_Address2"].Value.ToString();
                iadd3.Text = row.Cells["Invoice_Address3"].Value.ToString();
                iadd4.Text = row.Cells["Invoice_Address4"].Value.ToString();
}
Posted
Comments
George Jonsson 30-Jun-14 0:49am    
Have you tried to implement the CellEnter event?
chaitanya556 30-Jun-14 23:48pm    
yaaa i implemented and its working thankyou.... :-)
George Jonsson 1-Jul-14 0:48am    
Glad to be of service.

1 solution

Use "CellEnter" event. It will do the job :)
 
Share this answer
 
Comments
chaitanya556 30-Jun-14 23:49pm    
thank you... i got the solution....

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