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
|