Results 1 to 4 of 4

Thread: Really new to VB

  1. #1

    Thread Starter
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Really new to VB

    Hi,

    This is just something simple that im sure you can all answer.

    In access you can create a list box and set its Row Source to look up a query.

    How is this done in VB.
    Cheers

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Really new to VB

    You can bind a list (any type of list, including a DataTable) to a ListBox via its DataSource property. Populating that DataTable from a database is a completely independent operation.

    http://www.vbforums.com/showthread.php?t=469872
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: Really new to VB

    Thanks,

    So you can bind a listbox to a query in your data source?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Really new to VB

    Quote Originally Posted by mrmojorisin
    Thanks,

    So you can bind a listbox to a query in your data source?
    No. As I have already said, you can bind a ListBox to a DataTable that contains data. Populating that DataTable from a database using a query is a completely separate operation that I have exemplified in the thread I provided a link to.

    The ListBox doesn't care where the data in the DataTable came from, or even if the list it's bound to is a DataTable. Data-binding and data access are two separate things that are often used together because displaying data from a database is often a desirable thing to do.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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