Binding textboxes to binding source

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harmansodhi03
    New Member
    • Aug 2007
    • 18

    Binding textboxes to binding source

    Dear All

    I want to attach textboxes to bindingnavigato r by writing code for it, but I am not able to do it thru coding. I have written following code. Please help

    dim dr as datareader
    dr = cmd.ExecuteRead er()
    If dr.Read() Then
    TextBox1.Text = dr(0)
    TextBox2.Text = dr(1)
    TextBox3.Text = dr(2)
    TextBox4.Text = dr(3)
    End If
    Dim bs1 As New BindingSource()
    bs1.DataSource = dr
    BindingNavigato r1.BindingSourc e = bs1

    Harman
  • moiashvin
    New Member
    • Sep 2006
    • 16

    #2
    Hi Harman,

    To get you on the right track, I think it would be wise to use the Textbox.DataBin dings.Add method to bind the Text property of the text box to the datasource. Hope it helps.

    Ashvin
    http://moiashvin-tech.blogspot.c om

    Comment

    Working...