473,672 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass a collection of comboboxes to a Sub?

5 New Member
Hello everyone,
I would like too generate a number of comboboxes at runtime and then pass them to a Sub, like this:
Expand|Select|Wrap|Line Numbers
  1. For i = 0 to maxnumber
  2.   Dim cbo As New ComboBox()
  3.   cbo.Name = "cbo" & i
  4.   etc...
  5. Next
  6. etc...
  7. Myroutine("collection of comboboxes")
  8.  
  9. Sub Myroutine(ByVal "collection of comboboxes")
  10.   ...do something with the comboboxes...
  11. End Sub
  12.  
What is the correct syntax to use to pass the comboboxes collection to the Sub?

Thank you.
Feb 6 '10 #1
4 1378
tlhintoq
3,525 Recognized Expert Specialist
When you are making the comboboxes add them to a List<combobox> or an array combobox[] then send that array
Feb 6 '10 #2
axplains
5 New Member
Tlhintoq, tThank you very much for you input, I have tried:

Dim ComboList As List(Of Combobox) = Nothing
For i etc...
Dim cbo As New ComboBox()
ComboList.Add(c bo)
Next

but I get an error "Object reference not set to an instance of an object".
There is still something I am missing...
Feb 6 '10 #3
tlhintoq
3,525 Recognized Expert Specialist
Dim ComboList As List(Of Combobox) = Nothing
Try setting your ComboList equal to a new List(Of Combobox) instead of setting it to nothing (null)
Feb 6 '10 #4
axplains
5 New Member
Thanks a lot... that made it!
Feb 6 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1689
by: Wandy Tang | last post by:
Dear All, How to pass a collection from a VB Component to an ASP page? I have no clue the syntax of all. Many Thanks. Regards, Wandy Tang
1
4174
by: Andrés Giraldo | last post by:
Hi! I'm trying to pass trough all the objects of a form but I have some text inputs in a DIV and I have many DIVs like this on my form. I'm doing something like: for (i = 0; i < document.forms(0).item.length; i++) { dosomethingwith(document.forms(0).item(i)); }
5
7472
by: Mark Dicken | last post by:
Hi All, I am trying to Pass A Collection To A FUNCTION ??? (Access 2000) I have a Class called BO (for Business Objects) Within BO I have a Function called ShowCollection Public Sub showcollection(colCollection As Collection) MsgBox "colCollection(2)=" & colCollection(2)
1
7671
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into the bottom of this email)
0
1930
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set to and the source object is the subform. My subform record source is a query from another table (vacationTbl). FYI: I was filtering on the subform, but removed it and replaced with
4
11976
by: deko | last post by:
This is a basic program flow question. I'm trying to refractor an AC2000 app and split sections of code into separate modules. But there are a number of collections I create in one big module - containing file paths, Excel worksheet names, etc - I'm not sure how to pass these around, or if I'd be better off saving things to a table and using a recordset. My guess is a recordset would be slower. For example, should I do something like...
1
1930
by: Josema | last post by:
Hi to all, i have a class (of type collectionbase) that creates a collection of objects for instance persons. For other hand i have a Datagrid whose Datasource its the collection wich i talked in last paragraph. Until here no problem, the Grids shows to me the collection.
4
3222
by: Alexander Kolev | last post by:
I have a huge struct with many members.I don't want to copy this struct to the stack, that's why i pass it by reference to a function. But also i want the function to be unable to modify it. Something like that in C++: bool func( const Str& myStr ) { .... }
1
1310
by: Craig G | last post by:
for months we have been dabling round looking at various 3rd party comboboxes that allow the user to type text into the combobox as a search mechanism what we've found is that the likes of OpinatedGeek comboboxes do seem to work for exacrtly what we want to do but only if you use IE! if i try and run them in netscape navigator it falls over with errors on the load/rendering of the actual control itself so is there any 3rd party...
2
11448
by: Matt | last post by:
Hi all, me again! :) I've now got an issue with combo boxes. Basically, I have a number of items that I want a user to pick from a single list. It's basically along the lines of: Fruit 1: Fruit 2: Fruit 3:
0
8486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7446
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.