How do I pass DataGridView selected row value to TextBox in another form?

how passing a datagridview value to another form in c#
how to pass data from one datagridview to another datagridview in c#
c# datagridview show selected row data in another form using c#
c# pass datagridview to another form
how to get selected row value in datagridview in c# windows application
how to transfer data from one datagridview to another datagridview in c#
access datagridview from another form c#
how to pass datatable from one form to another in c# windows application

Your problem exists because you are using ShowDialog() method instead of Show(). From this answer on Stack Overflow:

The Show function shows the form in a non modal form. This means that you can click on the parent form.

ShowDialog shows the form modally, meaning you cannot go to the parent form.

Somehow that interacts with passing the value from one form to another, I think it happens because the first form gets blocked (paused) after ShowDialog() method therefore preventing you from copying the value from DataGridView.

If you used ShowDialog() method on purpose, then you can try to bypass this limitation somehow. For example, I managed to pass the required value from DataGridView to TextBox in a newly created Form (lets call it Form2) by using the Owner property (check this answer too) and Form.Shown event. You can try replacing your code with this piece in your button1_Click event handler (or probably just creating Shown event handler in your file with Form2 class):

Form2 fr = new Form2();
int row = DataGridView1.CurrentRow.Index;
fr.Shown += (senderfr, efr) => 
    // I did null check because I used the same form as Form2 :) 
    // You can probably omit this check.
    if (fr.Owner == null) return;

    var ownerForm = (Form1)fr.Owner;
    fr.Textbox1.Text = ownerForm.DataGridView1[0, row].Value.ToString();
    fr.Textbox2.Text = ownerForm.DataGridView1[1, row].Value.ToString();

P.S. Why would you use Convert.ToString() instead of simply calling ToString() method on Value property like I did in the example?

Datagridview selected row passing to another form2 textboxes , Hi, try making some resarch before posting questions! Passing Data Between Forms[^] Good luck. In This C# Tutorial We Will See How To Get And Show DataGridView Selected Row Data To Another Form On GridView Click Using CSharp Programming Language. subscribe for more tutorials

First you should do the Form1's datagridview modifiers public. When you click the button from Form1, open the Form2 and write this code to Form2_Load().

 Form1 frm = (Form1)Application.OpenForms["Form1"];
 int row = frm.DataGridView1.CurrentRow.Index;
 Textbox1.Text = Convert.ToString(frm.DataGridView1[0, row].Value);
 Textbox2.Text = Convert.ToString(frm.DataGridView1[1, row].Value);

This should work.

Passing datagridview values to another form c Sharp windows , Passing datagridview values to another form c Sharp windows. cell click event c#, Get Duration: 4:41 Posted: Mar 17, 2016 Csharp Datagridview Checked Value to Pass Another Form Datagridview Vetrivel D. Pass checked datagridview row to another datagridview . C# Copy Selected Rows in One Datagridview to another

  Form2 fr = new Form2();
  private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
    int row = DataGridView1.CurrentRow.Index;
    fr.Textbox1.Text = Convert.ToString(DataGridView1[0, row].Value);
    fr.Textbox2.Text = Convert.ToString(DataGridView1[1, row].Value);    

private void button1_Click(object sender, EventArgs e)

gridview selected row value to textbox on another form, how to retrive value of selected row of gridview in textbox while gridview and textbox both r on different window form i.e. form1 and form2. DataGridView dgv = (DataGridView)sender; DataGridViewSelectedRowCollection� When the DataGridView Row is clicked, the Row Index of the selected DataGridView Row is determined and the values of the Cells are extracted and passed (sent) to the other Form in Windows Forms (WinForms) Application using C# and VB.Net. Download Download Free Files API

Passing data from selected row in DataGridView to TextBoxes in , Rows.GetRowCount(DataGridViewElementStates.Selected); ToString( dataGridView_Salary.CurrentRow.Cells["Sr_No"].Value)); ViewContact is another form that only has TextBoxes which should be filled with data from� Pass (Send) DataGridView values to another DataGridView When the Transfer Button is clicked, a loop is executed over the DataGridView rows. Inside the loop, a check is performed whether the CheckBox is checked (selected) or not.

Pass DataGridView selected cell value to TextBox in another Form , Yeah ISform is the main form; they click a button that opens another form containing the datagridview. the user puts in a filter; selects the row� Passing datagridview values to another form c Sharp windows. Gridview row Double click open new form with that row data in C# - Duration: 7:47. code factory 2016 41,371 views

C# Show DataGridView Selected Row Data In Another Form, C# - How To Display DataGridView Selected Row Values On Another Form Using C#. In This Duration: 3:35 Posted: Sep 1, 2016