473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 1449
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Greener | last post by:
Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? If this is the case, what's wrong with the following? <script...
6
by: Rtritell | last post by:
Please can you find out what's wrong, fix the script and tell me what was wrong. Im just beginning <html> <head> <title>Random Mad Lib!</title> <script language="JavaScript"> <!-- Hide
7
by: Vic | last post by:
Dear All, I found this code snippet on this list (taken from a nice webpage of a courteous fellow), which I used to filter a form on a combo box. I wanted to repeat the same code to have an...
3
by: J | last post by:
I've moved the database tables from the .mdb file to Sql Svr and now I have an *intermittent* problem. When I select a record from a combo box, it will intermittently pull up the wrong record. ...
2
by: khan | last post by:
SELECT Products.Manufacturere, Products.ProductDescription, Products.SerialNumber, Products.QtyOnHand, Products.Location FROM Products WHERE (((Products.Manufacturere)=!!) AND...
6
by: doncee | last post by:
This is the set up: is a date field on a form. Its control source is the field "date_entered" in"Table1". If there is a date showing in the date_entered field (Text6) & the status in Combo box2...
28
by: federico_bertola | last post by:
Hi everybody! I have this function: int Scan(char String) { printf("%s", String); } it works but when I try to pass a dotted string o separetad with (" ", "_" , "-" ...ecc)
34
by: radink | last post by:
Well, I've got my DB ready to go. Now what? I need to host it on our Win2003 server. How do clients use it? I think im getting more confused as I try to figure this out. We are a small company...
12
by: azalea45 | last post by:
Hi all I am a newbie when it comes to access. My company requires that all Databases run on the company SQL back-end as a result i have a Access project that connects to the server. I have two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.