|
-
Aug 3rd, 2002, 03:44 PM
#1
Thread Starter
New Member
data binding with controls in code
Hi
I'm using ADO.NET to work with my database. In form_load procedure, after connecting and loading data in data set, and after setting CurrencyManager, I'm setting data binding for my 2 text boxes:
txtFName.DataBindings.Add("Text", data_set.Tables("People"), "f_name")
txtLName.DataBindings.Add("Text", data_set.Tables("People"), "l_name")
This all works fine, when I start my app I get the right data in my 2 text boxes. But, when I hit "move next" button the data in text boxes does not change.
The code behind move next button is simple:
cur_man.Position += 1
Where is the problem ?
Thanks.
Complete code listing:
Private data_set As New DataSet()
Private daPeople As Data.OleDb.OleDbDataAdapter
Public Conn_s As String
Private WithEvents Cur_Man As CurrencyManager
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Conn_s = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\people.mdb"
daPeople = New Data.OleDb.OleDbDataAdapter("select * from people", Conn_s)
daPeople.TableMappings.Add("Table", "People")
daPeople.Fill(data_set)
Cur_Man = Me.BindingContext(data_set, "People")
txtFName.DataBindings.Add("Text", data_set.Tables("People"), "f_name")
txtLName.DataBindings.Add("Text", data_set.Tables("People"), "l_name")
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Cur_Man.Position += 1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|