A
awade
OK. I appreciate anyone's help with this. This is my first main
program using VB.NET 2005. I've previously programmed in VB6.
I've got a form with a datagridview object. Its bound to an SQL 2005
Express database. I currently can update the cells in the
datagridview, and it updates the database when i use the mouse to
click on another record in the datagridview. I don't really want it
to work this way, and it causes two seperate issues.
1. I have a filter set to filter out completed records once they've
been updated based on a check i have in place. This works ok, except
I am always left with one record in my datagridview that doesn't get
updated. I'm guessing this is because I don't have another record in
my datagridview to click on.
2. I don't want to have to depend on the manual 'clicking' of the
next item in my datagridview in order to have it update my database.
There obviously is a programmable means that I'm just not grasping at
the moment.
Situation: I have a data table in my SQL database, that is a list of
parts that are tied to a manufacturing job. As the individual parts
get made i currently update a date field and another 'completed' field
for each line item for that job. My startup form loops through my
database for uncompleted jobs, and then displays only the job number
for the jobs that still have uncompleted parts. The user clicks on
the job number in question and then it opens my sub-form... this is
the one that i'm having issues with. This form has a 'packing list
quantity' text box bound to the database, a 'quantity made' text box
that is also bound to the database, and a datagridview (bound as well)
showing the part names for that job and some details about the part.
I have a check box that allows them to hide the completed parts -
which can be quite helpful if you have a lot of parts in the list.
The check box looks at the 'completed' field and sets up the filter
for the data that gets loaded into the datagridview. The user is to
input the quantity of each part made for a given date, and my program
is to write a record out to a history table (that is working OK), and
update the 'date' and 'completed' fields when the line item parts are
finished. Idealy, the user could use the arrow keys to navigate down
the datagridview while using the number pad to input the quantity...
all without having to use the mouse.
OK. Here is my form_load on my sub-form... this seems to work well.
'Set manufacturing prefix
strJobNo = "05" & txtJobNo.Text
'Set filter for database
Select Case strTeam
Case "10"
lblTitle.Text = "STRUCTURAL"
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "20"
lblTitle.Text = " COLDFORM "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "30"
lblTitle.Text = " PANEL "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "40"
lblTitle.Text = " TRIM "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "60"
lblTitle.Text = " UTILITY "
strJobFilter = ""
End Select
If chkHide.Checked Then
strJobFilter = strJobFilter + " and BOM_COMPLETED = '0'"
End If
strJobFilter2 = "BOM_QTY_LOADED = ''"
'Load packing list for job and manufacturing line
Me.BOMBindingSource.Filter = strJobFilter
Me.BOMTableAdapter.Fill(Me.GSMDataSet.BOM)
'Load history for packling list
Me.BOMTOBOMMFGBindingSource.Filter = strJobFilter2
Me.BOM_MFGTableAdapter.Fill(Me.GSMDataSet.BOM_MFG)
I currently use an key_press.enter event for adding and updating my
grids... here is what I have.
If Asc(e.KeyChar) = Keys.Enter And txtMadeToday.Text <> "" Then
' Update Quantity
strTotalQty = Str(Val(txtMadeToday.Text) +
Val(txtTotalMade.Text)
txtTotalMade.Text = strTotalQty
' Update Completion Date
If txtPLQty.Text = txtTotalMade.Text Then
'gets the time formated for our VSE system using
DateTime routine
txtBOM_COMPLETION_DATE.Text =
Mid(DateTime(Me.txtDate.Text), 1, 8)
' make database field for part completed here -
will be used for hiding completed records
txtComplete.Text = "1"
End If
Me.BOMTableAdapter.Update(Me.GSMDataSet.BOM)
' Calculate and load BOM_MFG table for History
strMfgKey = txtBOM_KEY.Text
strBomKey = strMfgKey
strMfgKey = strMfgKey + DateTime(Now)
strQtyMade = Str(Val(txtMadeToday.Text)
strDateMade = Mid(DateTime(Me.txtDate.Text), 1,
8)
strWeightMade = Str(Val(txtUnitWeight.Text) *
Val(strQtyMade))
strDateEntered = DateTime(Now) '
strQtyLoaded = "" : strDateLoaded = "" :
strWeightLoaded = "" : strLoadDateEntered = ""
BOM_MFGTableAdapter.Insert(strMfgKey, strBomKey,
strQtyMade, strDateMade, strWeightMade, strDateEntered, strQtyLoaded,
strDateLoaded, strWeightLoaded, strLoadDateEntered)
txtMadeToday.Text = ""
e.Handled = True
Me.BOM_MFGTableAdapter.Fill(Me.GSMDataSet.BOM_MFG)
End If
I'll be glad to provide more information... and any help that anyone
can give would be greatly appreciated.
Thanks in advance...
-andrew
program using VB.NET 2005. I've previously programmed in VB6.
I've got a form with a datagridview object. Its bound to an SQL 2005
Express database. I currently can update the cells in the
datagridview, and it updates the database when i use the mouse to
click on another record in the datagridview. I don't really want it
to work this way, and it causes two seperate issues.
1. I have a filter set to filter out completed records once they've
been updated based on a check i have in place. This works ok, except
I am always left with one record in my datagridview that doesn't get
updated. I'm guessing this is because I don't have another record in
my datagridview to click on.
2. I don't want to have to depend on the manual 'clicking' of the
next item in my datagridview in order to have it update my database.
There obviously is a programmable means that I'm just not grasping at
the moment.
Situation: I have a data table in my SQL database, that is a list of
parts that are tied to a manufacturing job. As the individual parts
get made i currently update a date field and another 'completed' field
for each line item for that job. My startup form loops through my
database for uncompleted jobs, and then displays only the job number
for the jobs that still have uncompleted parts. The user clicks on
the job number in question and then it opens my sub-form... this is
the one that i'm having issues with. This form has a 'packing list
quantity' text box bound to the database, a 'quantity made' text box
that is also bound to the database, and a datagridview (bound as well)
showing the part names for that job and some details about the part.
I have a check box that allows them to hide the completed parts -
which can be quite helpful if you have a lot of parts in the list.
The check box looks at the 'completed' field and sets up the filter
for the data that gets loaded into the datagridview. The user is to
input the quantity of each part made for a given date, and my program
is to write a record out to a history table (that is working OK), and
update the 'date' and 'completed' fields when the line item parts are
finished. Idealy, the user could use the arrow keys to navigate down
the datagridview while using the number pad to input the quantity...
all without having to use the mouse.
OK. Here is my form_load on my sub-form... this seems to work well.
'Set manufacturing prefix
strJobNo = "05" & txtJobNo.Text
'Set filter for database
Select Case strTeam
Case "10"
lblTitle.Text = "STRUCTURAL"
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "20"
lblTitle.Text = " COLDFORM "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "30"
lblTitle.Text = " PANEL "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "40"
lblTitle.Text = " TRIM "
strJobFilter = "BOM_JOBNBR = '" & strJobNo & "' and
BOM_PL_SEQ = '" & strTeam & "'"
Case "60"
lblTitle.Text = " UTILITY "
strJobFilter = ""
End Select
If chkHide.Checked Then
strJobFilter = strJobFilter + " and BOM_COMPLETED = '0'"
End If
strJobFilter2 = "BOM_QTY_LOADED = ''"
'Load packing list for job and manufacturing line
Me.BOMBindingSource.Filter = strJobFilter
Me.BOMTableAdapter.Fill(Me.GSMDataSet.BOM)
'Load history for packling list
Me.BOMTOBOMMFGBindingSource.Filter = strJobFilter2
Me.BOM_MFGTableAdapter.Fill(Me.GSMDataSet.BOM_MFG)
I currently use an key_press.enter event for adding and updating my
grids... here is what I have.
If Asc(e.KeyChar) = Keys.Enter And txtMadeToday.Text <> "" Then
' Update Quantity
strTotalQty = Str(Val(txtMadeToday.Text) +
Val(txtTotalMade.Text)
txtTotalMade.Text = strTotalQty
' Update Completion Date
If txtPLQty.Text = txtTotalMade.Text Then
'gets the time formated for our VSE system using
DateTime routine
txtBOM_COMPLETION_DATE.Text =
Mid(DateTime(Me.txtDate.Text), 1, 8)
' make database field for part completed here -
will be used for hiding completed records
txtComplete.Text = "1"
End If
Me.BOMTableAdapter.Update(Me.GSMDataSet.BOM)
' Calculate and load BOM_MFG table for History
strMfgKey = txtBOM_KEY.Text
strBomKey = strMfgKey
strMfgKey = strMfgKey + DateTime(Now)
strQtyMade = Str(Val(txtMadeToday.Text)
strDateMade = Mid(DateTime(Me.txtDate.Text), 1,
8)
strWeightMade = Str(Val(txtUnitWeight.Text) *
Val(strQtyMade))
strDateEntered = DateTime(Now) '
strQtyLoaded = "" : strDateLoaded = "" :
strWeightLoaded = "" : strLoadDateEntered = ""
BOM_MFGTableAdapter.Insert(strMfgKey, strBomKey,
strQtyMade, strDateMade, strWeightMade, strDateEntered, strQtyLoaded,
strDateLoaded, strWeightLoaded, strLoadDateEntered)
txtMadeToday.Text = ""
e.Handled = True
Me.BOM_MFGTableAdapter.Fill(Me.GSMDataSet.BOM_MFG)
End If
I'll be glad to provide more information... and any help that anyone
can give would be greatly appreciated.
Thanks in advance...
-andrew