469,601 Members | 2,039 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

what went wrong with my combo box?

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
1 1276
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.

Similar topics

6 posts views Thread by Rtritell | last post: by
6 posts views Thread by doncee | last post: by
28 posts views Thread by federico_bertola | last post: by
34 posts views Thread by radink | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.