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:
As this works terrific you might wonder why I'm posting this.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
Here goes..... I took away the following rows:
and then set the databinding properties for the textboxes at DESIGN-Time...... and whoala.... doesn't work anymore.Code:TextBox1.DataBindings.Add(New Binding("Text", DataSet11.Employees, "FirstName")) TextBox2.DataBindings.Add(New Binding("Text", DataSet11.Employees, "LastName"))
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





Reply With Quote