how to update or add data using TextBox

C

Charms Zhou

Please see the code below :


public da1 As New OleDbDataAdapter()
public dt1 As New DataTable("menuCat")

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim e1 As OleDbException
Dim scmd1 As New OleDbCommand()
scmd1.CommandText = "SELECT catID,catName FROM menuCat"
scmd1.Connection = cn1
da1.SelectCommand = scmd1

Try
cn1.Open()
da1.Fill(dt1)

TextBox1.DataBindings.Add(New Binding("text", dt, "catID"))
TextBox2.DataBindings.Add(New Binding("text", dt3, "catName"))

Catch e1
MsgBox(e1.Message)
End Try
End Sub


Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Me.BindingContext(dt3).Position += 1
End Sub

Private Sub btPre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPre.Click
Me.BindingContext(dt3).Position -= 1
End Sub

Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
?
?
?
..
..
..
End Sub

Private Sub btnUpd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
?
?
?
..
..
..

End Sub

Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
?
?
?
..
..
..

End Sub


What statements shoud I fill in Sub btnNew_Click ,Sub btnUpd_Click and Sub btnCancel_Click to add ,update and cancel a new record?
Thanks so much!
 
A

Armin Zingler

Charms Zhou said:
What statements shoud I fill in Sub btnNew_Click ,Sub btnUpd_Click
and Sub btnCancel_Click to add ,update and cancel a new record?
Thanks so much!

This is not a VB.NET specific question. Please turn to
microsoft.public.dotnet.framework.windowsforms.databinding

Please also don't use HTML posting. Use plain text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top