Hi all,
I am try to make something that can update my database from my combobox, since I have 10 comboboxes on my form, and each perform the same function and had the same data source.
The scenario is that:
1. I have 2 tables that needed to update
2. I need to check whether the string that I typed on my combo box is existed on my database, if not, then add to the database.
The problems come in when I am trying to check my combo box, I tried many method, and still not working.
Can someone lead me with this?
Thanks very much
PlayKid
[VB]
Private Sub SupplierActivitesInformation()
Dim drSupplierActivities As DataRow
Dim c As Control
Dim count, countdata As Integer
dtSupplierActivities = DsSupplierActivities1.Tables("SuppliersActivities")
For count = 1 To 10
For Each c In ProvideActivitiesGroup.Controls
If (c.Name = "ComboBox" & CStr(count)) And (c.Text <> "") Then
drSupplierActivities = dtSupplierActivities.NewRow
drSupplierActivities("SupplierNo") = SupplierNo + 1
------------------------PROBLEM HERE-----------------------------------
dtSupplierActivities.Rows.Add(drSupplierActivities)
Call Savechanges(DsSupplierActivities1, daSupplierActivities)
End If
Next
Next count
End Sub
[/VB]
I am try to make something that can update my database from my combobox, since I have 10 comboboxes on my form, and each perform the same function and had the same data source.
The scenario is that:
1. I have 2 tables that needed to update
2. I need to check whether the string that I typed on my combo box is existed on my database, if not, then add to the database.
The problems come in when I am trying to check my combo box, I tried many method, and still not working.
Can someone lead me with this?
Thanks very much
PlayKid
[VB]
Private Sub SupplierActivitesInformation()
Dim drSupplierActivities As DataRow
Dim c As Control
Dim count, countdata As Integer
dtSupplierActivities = DsSupplierActivities1.Tables("SuppliersActivities")
For count = 1 To 10
For Each c In ProvideActivitiesGroup.Controls
If (c.Name = "ComboBox" & CStr(count)) And (c.Text <> "") Then
drSupplierActivities = dtSupplierActivities.NewRow
drSupplierActivities("SupplierNo") = SupplierNo + 1
------------------------PROBLEM HERE-----------------------------------
dtSupplierActivities.Rows.Add(drSupplierActivities)
Call Savechanges(DsSupplierActivities1, daSupplierActivities)
End If
Next
Next count
End Sub
[/VB]