By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

listbox.selecteditem to populate datagridview

P: 1
Sorry for newbie question, but here goes.

on form1 there is listbox1 and datagridview1

I have tables for dbo.category and dbo.issues.

in listbox1, is the listing from dbo.category.

what I want to do, is this:
click on an item in listbox1, say that is "APPLE"

I want that click event to take the selecteditem,query the dbo.issues and find every record with the category of "APPLE", and populate the datagridview1 with all of those records.

Back in the old days working with Access, it seemed a lot more simple.

Any suggestions on which route I take to accomplish the above task?

Thanks in advance.
Apr 4 '16 #1
Share this Question
Share on Google+
1 Reply

P: 299
You could just add a query to the ListBox1_SelectedIndexChanged to do a SELECT against dbo.issues. Inside of your SELECT statement, after WHERE, just include the ListBox1 selected item name as a variable for your query.
Apr 4 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.