Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function SqlPopulateMembers()
- Dim result As String = ""
- Dim myAdapter As New MySqlDataAdapter
- Dim myData As New DataTable
- Try
- Dim cmd As New MySqlCommand("SELECT * FROM Users", connection)
- SqlConnect()
- myAdapter.SelectCommand = cmd
- myAdapter.Fill(myData)
- With frmMembers
- .dgView.DataSource = myData
- .dgView.Columns(0).Visible = False
- .dgView.Columns(2).Visible = False
- .dgView.Columns(4).Visible = False
- .dgView.Columns(5).Visible = False
- .dgView.Columns(6).Visible = False
- End With
- connection.Close()
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- Return result
- End Function
- Private Sub dgView_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgView.CellFormatting
- If e.ColumnIndex = 3 Then
- Dim row As DataGridViewRow = dgView.Rows(e.RowIndex)
- Dim cell As DataGridViewCell = row.Cells(3)
- If CInt(cell.Value) = 0 Then
- Dim col As DataGridViewImageColumn = DirectCast(dgView.Columns(3), DataGridViewImageColumn)
- col.Image = dgImages.Images(0)
- ElseIf CInt(cell.Value) = 1 Then
- Dim col As DataGridViewImageColumn = DirectCast(dgView.Columns(3), DataGridViewImageColumn)
- col.Image = dgImages.Images(1)
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement