user1704812 user1704812 - 11 months ago 32 Question

How to bind a button into a particular element in dataset in

I can't seem to figure out how to bind a given element to a button on a Windows form.

When I go to

under the control's properties, I get a list of the columns, and then I click on one column called

I get
ItemsBindingSource - ID

What is the proper syntax to choose a given element from the selected column.

Uno Uno

You need to set the current item on the CurrencyManager:

Dim cm = CType(Me.BindingContext(<DataSource>), CurrencyManager)

' This will change the current record and trigger the update of the Button.
cm.Position += 1

If it's an autogenerated source from a SQL table, should be: Me.TableBindingSource.

To select a record based on some criteria, you can find the position of the item in the data source and set it to the manager:

Dim element = cm.List.OfType(Of DataRowView).Single(function(view) view.Item("Column").ToString() = "Value")

cm.Position = cm.List.IndexOf(element)

There are simple examples here: