label binding to bindingsource

  • Thread starter Thread starter GreydogMe
  • Start date Start date
G

GreydogMe

Guest
Hi All,

I'm hoping this is a quick fix that someone can see easily. I feel like I am just missing something basic/obvious, just not to me. I am using VB.Net and VS2012 and accessing an Access (2007+) database, though I don't think the database matters.

I have a datatable as the datasource of a bindingsource (bs). I have added a binding for a label. I am navigating to the first and last rows of the bindingsource and want to pick up the appropriate value in 2 text boxes, txtFirst and txtLast. I can see the correct value in the bindingsource after movefirst and movelast, but the label is not showing what is in the bindingsource. The label just shows its design-time default text. Any pointers on what I am missing?

Dim bs As New BindingSource

bs.DataSource = dtIndex 'datatable created previously

lblDataFind.DataBindings.Add("Text", bs, "Acctnum", False, DataSourceUpdateMode.OnValidation)

bs.MoveFirst()
txtFirst.Text = lblDataFind.Text
bs.MoveLast()
txtLast.Text = lblDataFind.Text

Continue reading...
 
Back
Top