Results 1 to 2 of 2

Thread: DataGrid is populated or not

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    11

    DataGrid is populated or not

    How do I found out if a datagrid is bound to any data table or not?

    I want to use the datagrid.datasource property to achieve this, but I am not sure how to do it.

    When the datagrid.datasource is undefined, I want to do something. So what should the if statement be like?

    if ( datagrid.DataSource == ??)

    Please let me know if anyone knwos this.

    Thanks
    QQ

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: DataGrid is populated or not

    You bind a bound control, like the datagrid, in design, not at runtime.

    I am a little confused as to how you would NOT know to what it was bound.

    Lets step through the process.

    You have a datagrid control on your VB form. You have a connection to a database, through, presumably, an ADO data control which provides access to the database and its tables.

    You want to bind your datagrid to one of those tables. Setting the datasource in the ADO data control provide you with a list of the available tables in the datasource property of the grid.

    Are you getting that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width