how can i transfer data from datagridview to textbox

  • Thread starter Thread starter Omi4u
  • Start date Start date
O

Omi4u

Guest
Dear All

i need something similar to attached image. 1st row of datagridview must fill with all details of textbox but in 2nd row and onward i do not want to fill the column2 section . i tried below code but it making extra row with all information .



Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress


If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


For ia As Integer = 0 To DataGridView1.Rows.Count - 1

If DataGridView1.Rows(ia).Cells(1).Value > 0 Then

DataGridView1.Rows.Add(TextBox1.Text, "0", TextBox3.Text, TextBox4.Text)

Else

DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text)


' DataGridView1.Rows(ia).Cells(8).Style.BackColor = Color.Red

End If

Next


End If




End Sub

1458232.jpg

Continue reading...
 
Back
Top