Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok i have a table called hole. The table Hole has a holeid

 

Hole

HoleId

1

2

3

 

I am tring to databind the inform into a label and i want to retrieve the information from HoleId for hole 2 any suggestions

The code that i tried is the following where am i going wrong

 

lblHole2.Databinding.Add("Text",ds.Tables["Hole"].Columns["1"],"HoleId");

Posted

There is a method called BindingContext that does quite what you want.

 

If in the form you use the table 'hole' you assign a DataRow like this:

Dim dr As DataRow = Me.BindingContext(hole).Current

This line will assign the current working row of the table 'hole' to the DataRow 'dr'.

 

Having this, just use this line to retrieve the value on the HoleID column:

Dim HoleID As Integer = dr("HoleIDColumnName")

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...