I have Visual Studio .NET with all of the components installed onto it. I
want to add items to a combo box at run-time through numerous subroutines. I
previously did it with the combo boxes AddItem method, but in .NET's version
it gives me an error, because the method no longer exists. I know I can use
the Items property, but that is Read-Only at run-time.
I previously used Microsoft Visual Basic 6 (not a Visual Studio component)
and it worked fine before, but now the AddItem and RemoveItem methods are
gone. 5 3060
Jan. 13, 2005
No, you can't add items to the collection by using:
dim coll as objectcollection
coll = combobox1.items
coll.add("...")
You can add items at runtime though with:
combobox1.Items.Add("MyItem")
I hope this answers your question and I hope you have a great day!
Joseph MCAD
"Chaos2651" wrote: I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem method, but in .NET's version it gives me an error, because the method no longer exists. I know I can use the Items property, but that is Read-Only at run-time.
I previously used Microsoft Visual Basic 6 (not a Visual Studio component) and it worked fine before, but now the AddItem and RemoveItem methods are gone.
"Chaos2651" <Ch*******@discussions.microsoft.com> schrieb: I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem method, but in .NET's version it gives me an error, because the method no longer exists. I know I can use the Items property, but that is Read-Only at run-time.
\\\
Me.ListBox1.Items.Add("Hello World")
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Why do you think this will not work? You are just making a reference to the
collection and then adding items to that collection. It will work.
Dim ComboBox1 As New ComboBox
Dim coll As ComboBox.ObjectCollection
coll = ComboBox1.Items
coll.add("...")
MessageBox.Show(ComboBox1.Items.Count)
Chris
"Joseph MCAD" <Jo********@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com... Jan. 13, 2005
No, you can't add items to the collection by using:
dim coll as objectcollection coll = combobox1.items coll.add("...")
You can add items at runtime though with:
combobox1.Items.Add("MyItem")
I hope this answers your question and I hope you have a great day!
Joseph MCAD "Chaos2651" wrote:
I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem method, but in .NET's version it gives me an error, because the method no longer exists. I know I can use the Items property, but that is Read-Only at run-time.
I previously used Microsoft Visual Basic 6 (not a Visual Studio component) and it worked fine before, but now the AddItem and RemoveItem methods are gone.
Thank you for a quick and speedy reply! I didn't know that the Items property
had subroutines. I'm more of a C++ guy rather than VB.
Thanks!
"Joseph MCAD" wrote: Jan. 13, 2005
No, you can't add items to the collection by using:
dim coll as objectcollection coll = combobox1.items coll.add("...")
You can add items at runtime though with:
combobox1.Items.Add("MyItem")
I hope this answers your question and I hope you have a great day!
Joseph MCAD "Chaos2651" wrote:
I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem method, but in .NET's version it gives me an error, because the method no longer exists. I know I can use the Items property, but that is Read-Only at run-time.
I previously used Microsoft Visual Basic 6 (not a Visual Studio component) and it worked fine before, but now the AddItem and RemoveItem methods are gone.
Jan. 13, 2005
Your welcome! And the reason that your code won't work Chris, is
because the collection returned by ComboBox1.Items is readonly.
Dim ComboBox1 As New ComboBox
Dim coll As ComboBox.ObjectCollection
coll = ComboBox1.Items 'This returns a readonly collection and cannot be
added to
coll.add("...")
MessageBox.Show(ComboBox1.Items.Count)
You must add to the collection through the combobox instead. Have a
great day!
Joseph MCAD
"Chaos2651" wrote: Thank you for a quick and speedy reply! I didn't know that the Items property had subroutines. I'm more of a C++ guy rather than VB.
Thanks!
"Joseph MCAD" wrote:
Jan. 13, 2005
No, you can't add items to the collection by using:
dim coll as objectcollection coll = combobox1.items coll.add("...")
You can add items at runtime though with:
combobox1.Items.Add("MyItem")
I hope this answers your question and I hope you have a great day!
Joseph MCAD "Chaos2651" wrote:
I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem method, but in .NET's version it gives me an error, because the method no longer exists. I know I can use the Items property, but that is Read-Only at run-time.
I previously used Microsoft Visual Basic 6 (not a Visual Studio component) and it worked fine before, but now the AddItem and RemoveItem methods are gone.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Oren Kaplan |
last post by:
Hello,
I posted a msg on the Access-related groups in hope someone there
could help me but since almost two days have past and I didnt get a
response (Im a bit hard pressed with the problem) I...
|
by: Wayne Wengert |
last post by:
I am trying to populate a combobox with a lisy of items. I want the 1st item
to be "Make a Selection" and the following items will be names from a table
in my DB (See code below).
When I run the...
|
by: Tonya |
last post by:
Hi,
I want to write code that will fill my combobox ONLY IF it
is currently empty. i need this code to run for the
combobox1.selectedindexchanged event. i wanted to know how
i can code this.
I...
|
by: Steve |
last post by:
I have an unbound combobox in the form header of a continuous form. The
selection in the combobox sets the where clause in a querydef which determines
QryPFrmInventoryManagement. The following code...
|
by: jdk |
last post by:
I have a main form where a students name is selected. After selected the
name- the subform populates all criteria related to the students program. I
have 2 combo boxes in the subform that...
|
by: Cro |
last post by:
Dear Access Developers,
The 'Allow Additions' property of my form is causing unexpected
results.
I am developing a form that has its 'Default View' property set to
'Continuous Forms' and am...
|
by: polocar |
last post by:
Ciao a tutti,
leggendo qua e lą per il forum ho scoperto che non sono l'unico ad
avere questo problema.
Se si inserisce un controllo ComboBox in un form di C#, non č
possibile impostare la sua...
|
by: Frnak McKenney |
last post by:
Can I use a bound ComboBox for both browsing and editing?
I'm working on a small, standalone database application using Visual
C#.NET 2003 and an Access data file.
In order to keep the number...
|
by: graywolf |
last post by:
Hi there,
I have just started using Access 2003 in the last couple of months and have a couple of problems i would like some help with please for a project i am working on.
PROBLEM 1.
I have a...
|
by: Andrus |
last post by:
I need to enter null value from combobox to business object property.
My combobox datasource does not contain ValueMember with null value.
So I tried to create combobox which stores null to bound...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |