Setting Values in a Dataset

BrownFingers

Member
Joined
Nov 21, 2008
Messages
15
Programming Experience
Beginner
Hi, I'm new to winforms and was wondering how do I set a value on a dataset programmatically. I have some controls on a form which are bound to a bindingsource. Before I call EndEdit on that binding source, I want to ensure that the primary key is set. The primary key is just an integer value which I will be getting the next id from a "Next Id" table. This field is not bound to any control as there is no requirement for the users to view this id.

Can anyone help or point me in right direction?
 
You get the current record from the BindingSource in the form of a DataRowView:
VB.NET:
Dim currentRecord As DataRowView = DirectCast(myBindingSource.Current, DataRowView)

currentRecord("ID") = nextID
 

Latest posts

Back
Top