MacRaider4
Member
- Joined
- Jan 8, 2010
- Messages
- 13
- Programming Experience
- Beginner
I'm working on a project and my boss insists I use a DataGrid for this. The grid holds information for work orders, one of the cols has a check box in it. I need the user to be able to select any number of those checkboxes/rows and then return a value to the table "stamping" that users ID. This is what I have so far to get the grids populated... I'm using 2005 with a 2000 Access Database if that helps. Though this will be changed to SQL Server once we get it working (yay more work)...
I removed the code from the second grid to make it easier to read, obviously once I can get one to work the second shouldn't be as much trouble.
This is the check box: dgvNewBiz.Columns(1).HeaderText = "Select"
At this point if someone knows how to get it to recognize the click event of the check box and pass that row info to a variable that would be super as I'm sure I could probably figure it out from there. Thank you all in advance.
VB.NET:
Imports System.Data
Public Class DailyWork
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PaymentFileTracker.mdb"
Dim sqlNewBiz As String = "SELECT LogID, Selected, * FROM ImportFileLog"
Dim OleDBConn1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ConnString)
Dim ds As New DataSet()
Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlNewBiz, OleDBConn1)
Private Sub DailyWork_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDBConn1.Open()
OleDbDataAdapter1.Fill(ds, "NewBiz")
NewBizLoad()
OleDBConn1.Close()
'Clean up
OleDbDataAdapter1 = Nothing
ConnString = Nothing
End Sub
Private Sub NewBizLoad()
'New Business DataGrid
dgvNewBiz.AutoGenerateColumns = True
dgvNewBiz.DataSource = ds
dgvNewBiz.DataMember = "NewBiz"
'Declare and set alternating row styles
Dim objAlternatingCellStyle As New DataGridViewCellStyle()
objAlternatingCellStyle.BackColor = Color.AliceBlue
dgvNewBiz.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle
'Change col names and width
dgvNewBiz.Columns(0).HeaderText = "Log ID"
dgvNewBiz.Columns(0).Width = 30
dgvNewBiz.Columns(1).HeaderText = "Select"
dgvNewBiz.Columns(1).Width = 45
dgvNewBiz.Columns(2).HeaderText = "Import Client Group"
dgvNewBiz.Columns(2).Width = 70
dgvNewBiz.Columns(3).HeaderText = "File Name"
dgvNewBiz.Columns(3).Width = 70
dgvNewBiz.Columns(4).HeaderText = "Received On"
dgvNewBiz.Columns(4).Width = 70
dgvNewBiz.Columns(5).HeaderText = "Start Date"
dgvNewBiz.Columns(5).Width = 70
dgvNewBiz.Columns(6).HeaderText = "End Date"
dgvNewBiz.Columns(6).Width = 70
dgvNewBiz.Columns(7).HeaderText = "Progress"
dgvNewBiz.Columns(7).Width = 80
dgvNewBiz.Columns(8).HeaderText = "Designated Employee"
dgvNewBiz.Columns(8).Width = 70
dgvNewBiz.Columns(9).HeaderText = "Back Up Employee"
dgvNewBiz.Columns(9).Width = 70
'Clean up
objAlternatingCellStyle = Nothing
End Sub
End Class
I removed the code from the second grid to make it easier to read, obviously once I can get one to work the second shouldn't be as much trouble.
This is the check box: dgvNewBiz.Columns(1).HeaderText = "Select"
At this point if someone knows how to get it to recognize the click event of the check box and pass that row info to a variable that would be super as I'm sure I could probably figure it out from there. Thank you all in advance.