Athley
December 18th, 2002, 04:49 AM
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:
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:
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. :)
/Leyan
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:
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:
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. :)
/Leyan