Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I first start by thanking dave for his help but now again I want to retrieve all the data from datagridview after selecting one cell in the datagridview and pass that value in the method that calling another form below are the code for the first form:

private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
       {
           int i =int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
           if (e.ColumnIndex == (dataGridView1.Columns.Count - 9))
           {
               {
                  // int i = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                   updateFaults obj = new updateFaults(i);
                   obj.Show();
               }
           }

the following is the code for the second form:

private void updateFaults_Load(object sender, EventArgs e)
       {  
           cmbclient.Text = fault_id.ToString();
           textBox1.Text = fault_id.ToString();
           cmbsys.Text = fault_id.ToString();
           cmbsite.Text = fault_id.ToString();
           cmbcategory.Text = fault_id.ToString();
           textBox4.Text = fault_id.ToString();
           textBox5.Text = fault_id.ToString();
           textBox6.Text = fault_id.ToString();
       }


can someone help me please :(
Posted
Updated 1-Nov-10 23:37pm
v3
Comments
Arindam Tewary 2-Nov-10 5:18am    
Are you working with windows form?

Create a property and assign each column value into property then access these property on your next page since its a window form you can create a static property
 
Share this answer
 
Hi.
you can use of this code for example :

Textbox1.text=dataGridView1.SelectedRows[0].Cells[0].Value;
Textbox2.text=dataGridView1.SelectedRows[0].Cells[1].Value;
Textbox3.text=dataGridView1.SelectedRows[0].Cells[2].Value;
.
.
.
 
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