PC Review


Reply
Thread Tools Rate Thread

Combo Box Functionality

 
 
=?Utf-8?B?VGVycmFuY2U=?=
Guest
Posts: n/a
 
      27th Feb 2005
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").ToString())
cboAgency.DisplayMember = _
Trim(agenSet.Tables(0).Columns("agencyname").ToString())

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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGVycmFuY2U=?=
Guest
Posts: n/a
 
      28th Feb 2005
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").ToString())
> cboAgency.DisplayMember = _
> Trim(agenSet.Tables(0).Columns("agencyname").ToString())
>
> 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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo List Box Functionality dgrosh Microsoft Access Forms 3 17th Apr 2009 06:18 PM
Pen and Mouse tablet combo reduced functionality under Vista 64 bit deebs Windows Vista General Discussion 0 23rd Aug 2006 11:30 PM
Combo box functionality in tab pages =?Utf-8?B?SE1CUmljaw==?= Microsoft Access Forms 6 26th Jun 2006 10:44 PM
Combo Box Arrow/Functionality =?Utf-8?B?TVNST09LSUU=?= Microsoft Access Form Coding 6 17th Feb 2005 09:54 AM
Strange combo box functionality Edward Microsoft VB .NET 1 7th Jan 2004 04:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 PM.