Sub showdata_Lab()
autoid_Lb()
Dim strselect As String = ""
Dim CheckCol As New DataGridViewCheckBoxColumn
Try
strselect = "select * "
strselect &= " From Lab order by Lb_id "
connect()
Dim ds As New DataSet
With da
.SelectCommand = New OleDbCommand(strselect, conn)
.Fill(ds, "showLab")
End With
With dtgLb
.DataSource = ds.Tables("showLab")
.Columns.Insert(3, CheckCol)
.Columns(3).Width = 50
.Columns(3).HeaderText = "เลือก"
.Columns(0).HeaderText = "รหัส"
.Columns(1).HeaderText = "ชื่อการรักษา"
.Columns(2).HeaderText = "ราคา"
.Columns(0).Width = 100
.Columns(1).Width = 150
.Columns(2).Width = 100
.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight
.Columns(2).DefaultCellStyle.Format = ("#,##0")
.AllowUserToAddRows = False
.AllowUserToResizeColumns = False
End With
Catch ex As Exception
MessageBox.Show("เกิดข้อผิดพลาด :" & ex.Message & "กรุณาตรวจสอบ" & strselect)
Exit Sub
End Try
dtgLb.AlternatingRowsDefaultCellStyle.BackColor = Drawing.Color.WhiteSmoke
End Sub
Tag : .NET, Ms SQL Server 2005, Win (Windows App), VS 2005 (.NET 2.x)