|
-
Dec 18th, 2002, 04:34 AM
#1
Thread Starter
Registered User
Databinding with typed dataset [Resolved]
Hi all!
I tried the following:
Created a typed dataset from the Employees table in Northwind database of a SQL server, added 2 textboxes to a form. Added databindings for these texboxes throu code and created a BindingManagerBase to change postion on a button click..... Heres the code:
Code:
Dim bm As BindingManagerBase
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(DataSet11)
bm = Me.BindingContext(DataSet11.Employees)
TextBox1.DataBindings.Add(New Binding("Text", DataSet11.Employees, "FirstName"))
TextBox2.DataBindings.Add(New Binding("Text", DataSet11.Employees, "LastName"))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
bm.Position += 1
End Sub
As this works terrific you might wonder why I'm posting this. 
Here goes..... I took away the following rows:
Code:
TextBox1.DataBindings.Add(New Binding("Text", DataSet11.Employees, "FirstName"))
TextBox2.DataBindings.Add(New Binding("Text", DataSet11.Employees, "LastName"))
and then set the databinding properties for the textboxes at DESIGN-Time...... and whoala.... doesn't work anymore.
Has anyone encountered this before? Is this a BUG or am I missing somethin? Am I leaving something out?
Getting frustrated here, please help.
Last edited by Athley; Dec 20th, 2002 at 05:09 AM.
-
Dec 18th, 2002, 06:18 PM
#2
Thread Starter
Registered User
bump......
I'm getting desperate here.
-
Dec 20th, 2002, 04:05 AM
#3
Thread Starter
Registered User
I have found nothing about this at Microsoft, and it is something that people must have come by before me, so it feels like it can't be a bug (It would have been mentioned somewhere). I just cant see what I'm missing....
-
Dec 20th, 2002, 05:09 AM
#4
Thread Starter
Registered User
Whiiiiiiiihaaaaaaaaaaaaa ............. it worked with the following change:
bm = Me.BindingContext(DataSet11, "Employees")
Can't say why I had to change that just because I didn't add my bindings at runtime though......
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
|