473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Data Adapter and Listboxes - general questions

Hello
I'm new to VB.net and have a question about using data adapters
I have 3 text boxes and a list box on my form. The text boxes are search fields that query a SQL database and return a list that populates the list box. The user would enter text into any 1 of the text boxes, or none at all, then press a button. If no text is entered, the listbox is populated with all items in table (this I can do no problem :), otherwise if textbox A has data, the listbox returns the record associated with that item, the other 2 textboxes would return 0 to a few records if used
Now my problem..
I can bind my listbox to a dataset using the properties, but how do I bind it with potentially 4 datasets?
Or am I doing this wrong from the start??
TIA
amber
Nov 20 '05 #1
3 1444
Hi Amber,

Instead of binding it, when the button is clicked, simply .clear it and then
loop through the dataset/datatables that are appropriate and populate it
with listbox.items.add etc.

HTH,

Bernie Yaeger

"amber" <an*******@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
Hello,
I'm new to VB.net and have a question about using data adapters.
I have 3 text boxes and a list box on my form. The text boxes are search fields that query a SQL database and return a list that populates the list
box. The user would enter text into any 1 of the text boxes, or none at all,
then press a button. If no text is entered, the listbox is populated with
all items in table (this I can do no problem :), otherwise if textbox A has
data, the listbox returns the record associated with that item, the other 2
textboxes would return 0 to a few records if used. Now my problem...
I can bind my listbox to a dataset using the properties, but how do I bind it with potentially 4 datasets?? Or am I doing this wrong from the start???
TIA!
amber

Nov 20 '05 #2
How do I do that
Thx
ambe

Nov 20 '05 #3
Cor
Hi Amber,

I asume you have a button event

\\\Quickly typed as kind of psueduo
listbox1.datasource = nothing
if textbox1.text <> "" then
listbox1.datasource = myfirsttable
listbox1.displaymember= ....
else
if textbox2 <> "" then
listbox1.datassource = mysecondtable
etc
else
listbox1.datasource = myfourthtable.
etc
.....
end if
end if
////
I hope this works?

Cor

Hello,
I'm new to VB.net and have a question about using data adapters.
I have 3 text boxes and a list box on my form. The text boxes are search fields that query a SQL database and return a list that populates the list
box. The user would enter text into any 1 of the text boxes, or none at all,
then press a button. If no text is entered, the listbox is populated with
all items in table (this I can do no problem :), otherwise if textbox A has
data, the listbox returns the record associated with that item, the other 2
textboxes would return 0 to a few records if used. Now my problem...
I can bind my listbox to a dataset using the properties, but how do I bind it with potentially 4 datasets?? Or am I doing this wrong from the start???
TIA!
amber

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
9
by: Susan Bricker | last post by:
Hi. I have two questions ... (1) I want to use a Listbox to enable the user to select 1 or many items from the list. However, I'm having trouble figuring out how to find out t which items have...
1
by: Morys Kenworthy | last post by:
If I drag and drop a SQL table to a web form I get a connection and adapter created. Nice! If I drag a Visual Foxpro table to a web form or a table from the IBM AS/400 I get an error message:...
5
by: Rick | last post by:
The data adapter wizard allows you to add more than one table, but that doesn't seem to work right when setting up a dataset. Some of the documentation I have read states that only one table...
1
by: Adam | last post by:
This is kind of a tough question, but, I'm working on a program now and using sql data adapters with sql server to generate data tables. I'm updating the tables and then using the...
5
by: Alex | last post by:
Hey all - I've found a lot of 'snippet' examples of hitting a sqlserver db from a csharp windows app, but I want to make sure I understand the proper usage. In the examples, they usually...
9
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through...
9
by: Jenden0 | last post by:
I'm new to C# (and Microsoft in general) so this may be a simple problem, but I haven't been able to figure it out yet. I've got a database with a number of different tables and I want the user...
12
by: Randy | last post by:
Hi, Trying to pass along a table row delete to the datasource, but I'm crashing. Here is the code: Private Sub btnDeleteIngr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.