Results 1 to 4 of 4

Thread: Databinding with typed dataset [Resolved]

Threaded View

  1. #1

    Thread Starter
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width