473,324 Members | 2,501 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,324 software developers and data experts.

Cannot Insert or Add a String To a ComboBox

When a button is clicked, a date is inserted or added into a combo box like this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string);

Either way, the new string does not show up in the ComboBox. I get no errors or problems, it just will not work. At load time I am retrieving dates from an Oracle database and adding them to the ComboBox with out any problems. However, once the application is up and running I cannot add to the ComboBox. I have even tried saying ComboBox.Refresh() after adding or inserting the string, but it still does not show up. Has any one ever encountered this, and do you know how to fix it?

--
JOHN TYCE
Nov 16 '05 #1
2 12847
John,

Can you supply a code example? Are you binding to a data source for the
list contents first? This might be the cause if you are getting the
contents of the list this way.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"John Tyce" <jt***@chevrontexaco.com> wrote in message
news:Om**************@TK2MSFTNGP15.phx.gbl...
When a button is clicked, a date is inserted or added into a combo box like
this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string);

Either way, the new string does not show up in the ComboBox. I get no errors
or problems, it just will not work. At load time I am retrieving dates from
an Oracle database and adding them to the ComboBox with out any problems.
However, once the application is up and running I cannot add to the
ComboBox. I have even tried saying ComboBox.Refresh() after adding or
inserting the string, but it still does not show up. Has any one ever
encountered this, and do you know how to fix it?

--
JOHN TYCE
Nov 16 '05 #2
To better explain the problem, I cannot apply changes to a control when class instances are involved. For example: If I create a button on my main form and in that button's click event I write ComboBox.Items.Add(string), the string is added to the combo box without a problem. However, in my case, I am clicking a button on the main form which opens a dialog. Since it is a dialog, it is a separate form belonging to its own class. On that dialog a button is clicked. That buttons click event creates a new instance of the main forms class and calls a function in that class, passes it a string, and then calls ComboBox.Items.Add(string). In this case, the string does not show up in the combo box. Even if I insert new data into the database and then reload the combo box from the database the new data in the combo box will not show up unless I call form.Close() followed by form.Show(). I have already tried ComboBox.Refresh() and Update, neither helps. FYI the combo box is not bound to a datasource; I am simply looping through the rows and adding the column value of each row with the Items.Add function when populating the combo box (not when adding a single string). There has to be a way to insert a string into the combo box. I get the same results with a text box.

--
JOHN TYCE
"John Tyce" <jt***@chevrontexaco.com> wrote in message news:Om**************@TK2MSFTNGP15.phx.gbl...
When a button is clicked, a date is inserted or added into a combo box like this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string);

Either way, the new string does not show up in the ComboBox. I get no errors or problems, it just will not work. At load time I am retrieving dates from an Oracle database and adding them to the ComboBox with out any problems. However, once the application is up and running I cannot add to the ComboBox. I have even tried saying ComboBox.Refresh() after adding or inserting the string, but it still does not show up. Has any one ever encountered this, and do you know how to fix it?

--
JOHN TYCE
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
4
by: hao | last post by:
Hi, all When I use ASP to insert an record to a database, I got some errors and can not insert any value with Chinese Char. The only way I can do that is use "rst1.Addnew...rst1.update". Anyone...
2
by: Xavier | last post by:
Hello, I'm working on VS 2003 with the framework 1.1 SP1. I'm trying to insert a combobox on a datagrid . If i use a combobox with the property dropdownstyle = dropdownlist it's OK but if I...
1
by: spacejones | last post by:
I am currently using as my database Access 2002. I have a table which holds orders for certain products. Given that each record in this table has a quantity ordered field. I want to populate...
0
by: Luqman | last post by:
I have copied the following code from Internet, and copied it to a file named : test.aspx, and copied that file to c:\Inetpub\wwwroot Directory. When I type on my Internet explorer:...
7
by: grummanf6f | last post by:
Hello Gurus, this probably is real simple for you but for me it's a bummer. I have one table in which I have basic data collected of schools. I have another data that is detailed info on the...
2
by: krajah | last post by:
Need Help Here....... I'm using visual C#: How to insert the value that user have entered combobox and click button.The value will sent into database.This is in form1. In form2,if click button...
0
by: yukijocelyn | last post by:
I have experienced a problem here while doing a form for accessing datadbase using MS Access. I'm using the AccessDataSource control, and using Gridview to pull the data from the database. I am able...
1
by: rdsandy | last post by:
Hi, I have a table Risk, a table Mitigation and a table RiskArchive. I am taking the RiskID, Criticality and MitigationPlan fields from Risk, and MitigationActionID from Mitigation and inserting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.