Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Cell click or double cell click...open only first row...not selected row...

What I have tried:

DataGridViewRow CurrentRow = poreziDataGridView.SelectedRows[0];
               Form2 f1 = new Form2();

          f1.idTextBox.Text = poreziDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn1"].Value.ToString();
          f1.imeTextBox.Text = poreziDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn2"].Value.ToString();
          f1.procenatTextBox.Text = poreziDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn3"].Value.ToString();
          f1.fiksna_vrednostTextBox.Text = poreziDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn4"].Value.ToString();
          f1.redni_brojTextBox.Text = poreziDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn5"].Value.ToString();

          f1.ShowDialog();
Posted
Updated 23-Mar-18 22:34pm
Comments
j snooze 23-Mar-18 17:29pm    
what if on your cell click or double click even you did something like this
DataGridViewRow CurrentRow = poreziDataGridView.Rows[poreziDataGridView.CurrentCell.RowIndex]

1 solution

See example here: How to pass datagridview values from form1 to form 2 in C#[^]
This example is for a BindingList which is the recommended way for binding data to a DataGridView but you can use other variables too of course ...
 
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