Bindingsource and TextBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benniit
    New Member
    • May 2008
    • 54

    Bindingsource and TextBox

    Hi, am new in VB.NET 2008.
    Please how can programmaticall y bind a textBox to a BindingSource?
    As I could do that in Vb6 using Adodc in the ff code.

    Adodc1.RecordSo urce="Select * from staff"
    set TextBox1.DataSo urce=Adodc1
    TextBox.DataFie ld="staffID"
    Adodc1.Refresh


    Pls, how can that be done using a bindingsource?

    Hope to hear from u soon.
    Ben
  • aryanbs
    New Member
    • Mar 2009
    • 42

    #2
    Use it this way:

    TextBox1.DataBi ndings.Add(New System.Windows. Forms.Binding(" Text", YourBindingSour ce, "ColumnName ", True))

    To Clear all binding
    TextBox1.DataBi ndings.Clear()

    To remove specific binding
    TextBox1.DataBi ndings.Remove(b indingName) 'Above binding put in a variable

    Comment

    Working...