Databound control question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Databound control question

  1. #1
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353

    Databound control question

    How can I determine what field I have bound to a controls text property. It'll take me years to "get" this object model

    ...joe

  2. #2
    Join Date
    Dec 2004
    Posts
    717
    Can you told us more details?
    Best Regards,
    Michael Sync
    http://michaelsync.net

    The more you share,The more you get

  3. #3
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    Normally it is the control.DataTextField on a radio button list but depends on what control is being used
    Sri

  4. #4
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353
    Quote Originally Posted by Sync
    Can you told us more details?
    I'm trying to come up with a generic routine to run from the validating event to compare the value in the dataset with that in the bound control. If I put the bound column name in the controls tag field I can do this:

    Code:
    Dim ThisRow As DataRow = dsData.Tables("Table_Name").Rows(Me.BindingContext(dsData, "Table_Name").Position)
            If CType(sender, Control).Text <> ThisRow.Item(CType(sender, Control).Tag.ToString).ToString Then
    What I want to do is replace the CType(sender, Control).Tag.ToString with the value pulled from the controls object model. Currently these controls are textboxs, but I'd like the process to be able to handle any control type.

    ...joe

  5. #5
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353
    Found it!

    Code:
    CType(sender, Control).DataBindings("TEXT").BindingMemberInfo.BindingField.ToString
    I figured it had to be buried somewhere in the DataBindings.

    ...joe

Similar Threads

  1. Question about Data Control and Adding new Records
    By Anthony M. Saffer in forum VB Classic
    Replies: 4
    Last Post: 08-15-2001, 04:41 PM
  2. DataGrid Web control question
    By Ind- in forum ASP.NET
    Replies: 0
    Last Post: 02-09-2001, 12:02 PM
  3. WEIRD ActiveX control problem
    By Glenn in forum ASP.NET
    Replies: 0
    Last Post: 12-13-2000, 07:55 AM
  4. Animation Control question
    By treeve moss in forum VB Classic
    Replies: 0
    Last Post: 05-04-2000, 05:31 AM
  5. Form Container Control in VB5
    By Mark Alexander Bertenshaw in forum VB Classic
    Replies: 0
    Last Post: 05-03-2000, 11:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center