
-------------------------------------------------------------
Data Gridview Selected Row Code:
-------------------------------------------------------------
Try
Dim index As Integer
index = e.RowIndex
Dim selectedrow As DataGridViewRow
selectedrow = DataGridView1.Rows(index)
txtempidno.Text = selectedrow.Cells(0).Value
txtfirstname.Text = selectedrow.Cells(1).Value
txtmiddlename.Text = selectedrow.Cells(2).Value
txtlastname.Text = selectedrow.Cells(3).Value
DateTimePicker1.Text = selectedrow.Cells(4).Value
txtage.Text = selectedrow.Cells(5).Value
cmbgender.Text = selectedrow.Cells(6).Value
txtstreetbaranggay.Text = selectedrow.Cells(7).Value
txtcity.Text = selectedrow.Cells(8).Value
txtprovince.Text = selectedrow.Cells(9).Value
txtpostalcode.Text = selectedrow.Cells(10).Value
txtjobposition.Text = selectedrow.Cells(11).Value
txtsalary.Text = selectedrow.Cells(12).Value
txtdeductions.Text = selectedrow.Cells(13).Value
txtbonus.Text = selectedrow.Cells(14).Value
txtgrosssalary.Text = selectedrow.Cells(15).Value
txtnetpay.Text = selectedrow.Cells(16).Value
Catch ex As Exception
MsgBox(ex.Message)
End Try
Walang komento:
Mag-post ng isang Komento