johnnyc Posted March 3, 2004 Posted March 3, 2004 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"); Quote
AlexCode Posted March 3, 2004 Posted March 3, 2004 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 Quote Software bugs are impossible to detect by anybody except the end user.
johnnyc Posted March 3, 2004 Author Posted March 3, 2004 c'# Its c# code for a smart device application i need Quote
Moderators Robby Posted March 3, 2004 Moderators Posted March 3, 2004 The code for SD is the same as what Alex provided... DataRow dr = Me.BindingContext(hole).Current; Int HoleID = dr("HoleIDColumnName"); Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.