Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a row in the dataset then binding it!!

Status
Not open for further replies.

jennyek2000

Programmer
Sep 2, 2003
43
GB

I have used the following code to find a particular row in a dataset, but now how do I set the binding manager so that it displays the data for that row? (i.e. bmjobs.position = ??)

Dim mydatarow As DataRow
Dim Mydatacolumn(0) As DataColumn

Mydatacolumn(0) = mydataset.Tables("Jobs").Columns("JobNumber")
mydataset.Tables("Jobs").PrimaryKey = Mydatacolumn

mydatarow = mydataset.Tables("Jobs").Rows.Find(myfrmSearchjobs.searchIndex)

Thanks,

Jenny
 
To bind your controls eg Textboxes to your data.

Code:
TextBox2.DataBindings.Add("Text", dtlens, "cutlength")

"Text" is the property to Bind to
dtlens is the DataSource - in my case a Datatable
"cutlength" is the field name in the table

This only needs to be done once, generally after you have created your dataset.

WTrueman
...if it works dont mess with it
 
I have already bound the text box to the database like you have written. what I need to do is MOVE to the row that I have found in the dataset (i.e. display the row in the textboxes).

Jenny

 
Jenny

Im not quite sure why the bindings dont appear to work for you. You could always populate your textboxes manually.

textbox1.text = mydatarow.item("JobNumber")


WTrueman
...if it works dont mess with it
 
If I have already bound the text boxes and I use the rows.find method of the dataset, is the bindingmanager position supposed to automatiically go to the found row?

Jenny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top