473,466 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combo Box Functionality

I'm hoping someone can help me with an issue. What's happening is I'm binding
two datasets to a combo box from a dataset. The code is as follows:
Try
prodSet = New DataSet
agenSet = New DataSet

'DataBind the agency info and product info.
agenSet = sqlClass.LoadProductList("agencies")
cboAgency.DataSource = agenSet.Tables(0)
cboAgency.ValueMember = _
Trim(agenSet.Tables(0).Columns("agencyid").ToStrin g())
cboAgency.DisplayMember = _
Trim(agenSet.Tables(0).Columns("agencyname").ToStr ing())

prodSet = sqlClass.LoadProductList("product")
cboProduct.DataSource = prodSet.Tables(0)

'This is the value member that the db understands.
cboProduct.ValueMember = _
prodSet.Tables(0).Columns("listid").ToString

'This is the value that the user will see.
cboProduct.DisplayMember = _
prodSet.Tables(0).Columns("product").ToString

As you can see I try to Trim any trailing white spaces; however, when I load
the form the data displays the end of the displaymembers in other words the
white spaces. All of the displaymembers show up but when clicking on the
combo box and choosing a value the combo box highlights everything including
the spaces(if that make sense) So, when the user chooses a value the combo
box is highlighted blue, the values doesn't actually show until the combo box
loses focus. Instead highlighting just he word/text in the combobox
everything is highlighted including the white area. What am I doing wrong?
Please help.
--
TC
Jul 21 '05 #1
1 1253
Ok, I figured the answer out for anyone who's interested. As I was driving in
to work today; and being the fact that I don't have a radio in my car I
started thinking about this problem..then all of a sudden WHAM!! it hit me. I
knew the dataset was placing the data into a datatable including trailing
white spaces so since I was using Stored Procedures in this project I
realized the problem was in my procedure. I had to do a RTrim(fieldname) in
the sql statement that I had for the white spaces to show up. Silly me....

"Terrance" wrote:
I'm hoping someone can help me with an issue. What's happening is I'm binding
two datasets to a combo box from a dataset. The code is as follows:
Try
prodSet = New DataSet
agenSet = New DataSet

'DataBind the agency info and product info.
agenSet = sqlClass.LoadProductList("agencies")
cboAgency.DataSource = agenSet.Tables(0)
cboAgency.ValueMember = _
Trim(agenSet.Tables(0).Columns("agencyid").ToStrin g())
cboAgency.DisplayMember = _
Trim(agenSet.Tables(0).Columns("agencyname").ToStr ing())

prodSet = sqlClass.LoadProductList("product")
cboProduct.DataSource = prodSet.Tables(0)

'This is the value member that the db understands.
cboProduct.ValueMember = _
prodSet.Tables(0).Columns("listid").ToString

'This is the value that the user will see.
cboProduct.DisplayMember = _
prodSet.Tables(0).Columns("product").ToString

As you can see I try to Trim any trailing white spaces; however, when I load
the form the data displays the end of the displaymembers in other words the
white spaces. All of the displaymembers show up but when clicking on the
combo box and choosing a value the combo box highlights everything including
the spaces(if that make sense) So, when the user chooses a value the combo
box is highlighted blue, the values doesn't actually show until the combo box
loses focus. Instead highlighting just he word/text in the combobox
everything is highlighted including the white area. What am I doing wrong?
Please help.
--
TC

Jul 21 '05 #2

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

Similar topics

3
by: NB | last post by:
Let's say in the product table I have around 50,000 products (well, infact it has now about 2000 only, but it's growing very fast, hence the question here) In the order form, users will select...
4
by: Mike L | last post by:
Currently, when the user presses a letter key the combo box will go to the first item in the collection of the combo box starting with that letter. For example user presses on "R", and "R2F"...
1
by: Edward | last post by:
I have encountered a combo box acting with a mind of its own in a VB.NET Windows app. I have a wizard consisting of a tab control; depending on which page is being displayed the tabs are added...
7
by: Hans Merkl | last post by:
Hi, Can anybody recommend a combo box control (textfield + dropdown list) for ASP.NET? I have looked at some products and it seems they all have some problems. I haven't yet found a combo box...
7
by: Arnold | last post by:
Greetings Gurus, In a mainform's header, I have a combobox named comboStudents. The rowsource for this combobox is: SELECT -999 As StudentID, "<Add New Student>" As FullName, "aaa" As...
2
by: tuffs | last post by:
Hi All, I am new to this group and this is my first mail to the group. I have a requirement wherein we need to support type ahead functionality for combo boxes. For e.g. Say we have 5...
0
by: Cndla | last post by:
hi, I have two combo boxes in a form. Functionality is such that selecting a value from the first combo box changes the value in the second combo box. Now this works fine in a normal computer with...
19
by: pdesh3 | last post by:
I am developing an application for a hospital which provides Outpatient billing information. I have created appropriate tables required. I have to develop a client server system where from multiple...
2
by: Sid | last post by:
I need some help in setting up Access combo box. I am using three comboboxes in my form. Comb Box 1, Combo Box 2, Combo Box 3. The row source for each of the combo box is a seperate table. ...
30
ADezii
by: ADezii | last post by:
This week’s Tip of the Week will clearly demonstrate how you can dynamically set the Drop Down List Width of a Combo Box to the length of the longest item in its Row Source. The inspiration for this...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.