how to get the row index value in datagridview
-
hi i have a form name frmDataEntry with textboxCustID and textboxCustName and lookup form name frmCustAssist with texboxFilter, button Filter and datagridview then when i double click textboxCustID then frmCustAssist will show i have to look if customer already exist or not then if already exist i hav to get the value of row index ..then the custID and custName of that value selected will be fill in the formDataEntry in textboxCustID and textboxCustName how do code that that plz help my code is here..
in a frmCustAssist private void button1_Click(object sender, EventArgs e) { bindingSource1.Filter = "LASTNAME like '%" + textBox1.Text + "%'"; bindingSource1.Sort = "LASTNAME"; selected row value .. somwthing like that }
in a frmDataEntry selected value custID =textboxCustID selected value custname = textboxCustName -
hi i have a form name frmDataEntry with textboxCustID and textboxCustName and lookup form name frmCustAssist with texboxFilter, button Filter and datagridview then when i double click textboxCustID then frmCustAssist will show i have to look if customer already exist or not then if already exist i hav to get the value of row index ..then the custID and custName of that value selected will be fill in the formDataEntry in textboxCustID and textboxCustName how do code that that plz help my code is here..
in a frmCustAssist private void button1_Click(object sender, EventArgs e) { bindingSource1.Filter = "LASTNAME like '%" + textBox1.Text + "%'"; bindingSource1.Sort = "LASTNAME"; selected row value .. somwthing like that }
in a frmDataEntry selected value custID =textboxCustID selected value custname = textboxCustNameHi You shall insert a column to your datagridview with type of button(for example). you can set caption of button as "Select". So use the CellContentClick event and in the body of this event for getting data of row that user clicked on the button of same row use below code : dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString();
Best Regards, Reza Shojaee