473,397 Members | 2,084 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,397 software developers and data experts.

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 1250
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
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
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...

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.