저는 Visual Studio 2010을 사용하고 DataGridView
있습니다. 프로젝트에 대한 프로파일 링 시스템이 있고 이제 .NET Framework를 사용하여 VB에서 SQL로 추가 할 수 있습니다 .
지금하고 싶은 것은를 클릭하면 선택한 행을 편집하는 DataGridView
것입니다. 그러면 텍스트 상자가 채워집니다. 어떻게 할 수 있습니까?
CellClick
이벤트를 처리 할 수 있습니다 . DataGridView의 셀을 클릭하면이 이벤트가 트리거됩니다.
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
'Check if the user clicks on a valid row. ie: Not on the row header or column header
If e.ColumnIndex >= 0 AndAlso e.RowIndex >= 0 Then
'Set the textbox text to the specified column's value
Textbox1.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value '1st column
Textbox2.Text = DataGridView1.Rows(e.RowIndex).Cells(1).Value '2nd column
'Set the textbox3 text to the cell value the user just clicked on
Textbox3.Text = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
End If
End Sub
명심하십시오 DataGridView1.Rows(e.RowIndex).Cells(0)
(이 보이지 않거나 심지어 경우) DataGridView에 첫 번째 열 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다