By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

what went wrong with my combo box?

P: n/a
GS
I got a combobox box that I load at load time. the Item and vales ended up
in reverse order of each other, what went wrong?
the database table has the following row
code value
ebay http://www.ebay.com
google http://www.google.com
yahoo http://www.yahoo.com
However in the drop down list
displayed value used
ebay http://www.yahoo.com
google http://www.google.com
yahoo http://www.google.com

here is the code listing for populating the combobox
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Conn As New SqlConnection("Data
source=.\SQLEXPRESS;AttachDbFileName=C:\myCtl.mdf; Integrated
Security=True;Connect TimeOut=30;User Instance=True")
Using Conn
Dim queryString As String = "select code, value as Addr from
dbo.CodeTable where (codeTableName = 'FinCoUrl') And (sequence 0) order by
sequence"
Dim adapter As New SqlDataAdapter()
adapter.SelectCommand = New SqlCommand(queryString, Conn)
Dim datatable As New DataTable
adapter.Fill(datatable)

addressBar.DataSource = datatable.DefaultView
addressBar.DisplayMember = "code"
addressBar.ValueMember = "Addr"
End Using
WidthaddressBar = addressBar.Width
End Sub
the above code worked with a combox in another application . the only
diffference is the name

Is there some property on the combo I need to fix ?
Sep 7 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
GS
still don't know what went wrong after comparing every attributes in
Designer.

hoping for luck, I just deleted the combobox and copy in the other combobox
in designer mode and renamed it to what the new application use. Voila, it
just works the way it should.

strange.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:Oz**************@TK2MSFTNGP04.phx.gbl...
I got a combobox box that I load at load time. the Item and vales ended
up
in reverse order of each other, what went wrong?
the database table has the following row
code value
ebay http://www.ebay.com
google http://www.google.com
yahoo http://www.yahoo.com
However in the drop down list
displayed value used
ebay http://www.yahoo.com
google http://www.google.com
yahoo http://www.google.com

here is the code listing for populating the combobox
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Conn As New SqlConnection("Data
source=.\SQLEXPRESS;AttachDbFileName=C:\myCtl.mdf; Integrated
Security=True;Connect TimeOut=30;User Instance=True")
Using Conn
Dim queryString As String = "select code, value as Addr from
dbo.CodeTable where (codeTableName = 'FinCoUrl') And (sequence 0) order
by
sequence"
Dim adapter As New SqlDataAdapter()
adapter.SelectCommand = New SqlCommand(queryString, Conn)
Dim datatable As New DataTable
adapter.Fill(datatable)

addressBar.DataSource = datatable.DefaultView
addressBar.DisplayMember = "code"
addressBar.ValueMember = "Addr"
End Using
WidthaddressBar = addressBar.Width
End Sub
the above code worked with a combox in another application . the only
diffference is the name

Is there some property on the combo I need to fix ?


Sep 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.