Private Sub DGV_Subject_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV_Subject.CellClick
Dim re_sudid As String
user_id1 = FrmMain.user_idLogin
If e.RowIndex = -1 Then Exit Sub
With DGV_Subject
TxtCTeacher.Text = user_id1
TxtCSub.Text = .Rows.Item(e.RowIndex).Cells(1).Value.ToString
TxtCSec.Text = .Rows.Item(e.RowIndex).Cells(2).Value.ToString
TxtDate.Text = Date.Today
re_sudid = .Rows.Item(e.RowIndex).Cells(0).Value.ToString
strsql = "select Student.StudentID , Student.StudentName from Learn inner join Student on Student.StudentID = Learn.StudentID where Learn.SubjectID = '" & re_sudid & "' "
dtAdapter = New SqlDataAdapter(strsql, con)
dtAdapter.Fill(dt1)
Me.DGV_Check.DataSource = dt1
With DGV_Check
.Columns(0).HeaderText = "รหัสนิสิต"
.Columns(1).HeaderText = "ชื่อ-นามสกุล"
.Columns(0).Width = "150"
.Columns(1).Width = "200"
Dim ColumnCheckBox As New DataGridViewCheckBoxColumn()
ColumnCheckBox.Width = 30
ColumnCheckBox.DataPropertyName = "Select"
Me.DGV_Check.Columns.Add(ColumnCheckBox)
End With
End With
End Sub
ต้องเพิ่มส่วนไหนอีกไหมคะถึงจะเซ้คได้
Tag : Ms SQL Server 2008, VBScript, Win (Windows App), VS 2010 (.NET 4.x)