G
Guest
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.
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.