Hello.
My VB.Net project is connected with MS Access. Whenever input in VB, it will save in Access. I don't have any problem with textbox but I don't know what to do with checkbox and radiobutton.
I want, when checkbox or radiobutton is checked in VB, it will checked also in Access.
This is my code for textbox:
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim inc As Integer
Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
con.ConnectionString = "PROVIDER=Microsoft.Jet.Oledb.4.0; Data source =C:\Documents and Settings\~LaiLi~\My Documents\Visual Studio 2005\Projects\Party\Party\bin\Debug\Party.mdb"
sql = "SELECT * FROM Planner"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Planner")
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsnewrow As DataRow
If Not DoesAccountExist(EventComboBox.Text) Then
dsnewrow = ds.Tables("Planner").NewRow()
dsnewrow.Item("EventName") = EventComboBox.Text
dsnewrow.Item("ClientName") = ClientTextBox.Text
dsnewrow.Item("VenueName") = VenueTextBox.Text
ds.Tables("Planner").Rows.Add(dsnewrow)
da.Update(ds, "Planner")
MessageBox.Show("Data saved!")
With Me
EventComboBox.DisplayMember = 0
ClientTextBox.Clear()
VenueTextBox.Clear()
End With
End If
End Sub
What should I change to make Access save checkbox and radiobutton?