473,509 Members | 2,918 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CallByName w/ComboBox

For i = 1 To 3

CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "1st item")
CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "2nd item")
CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "3rd item")
next

Is there a way I can populate these 3 combo boxes using the CallByName feature. My form has 3 combo boxes named ComboBox1, ComboBox2, ComboBox3.

I would really Prreeeeeeciate your help!

Timberwoof - ô¿ô
From http://www.developmentnow.com/g/38_2...nguages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Apr 4 '07 #1
1 1744
>For i = 1 To 3
>
CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "1st item")
CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "2nd item")
CallByName(Form1.Controls("ComboBox" & i), "items.add", Type.Set, "3rd item")
next

Is there a way I can populate these 3 combo boxes using the CallByName feature. My form has 3 combo boxes named ComboBox1, ComboBox2, ComboBox3.
Any particular reason you want to use CallByName? If not, just do it
the strongly typed way

Dim combos() As ComboBox = {ComboBox1, ComboBox2, ComboBox3}
Dim items() As String = {"1st item", "2nd item", "3rd item"}
For Each c As ComboBox in combos
For Each s As String in items
c.Items.Add(s)
Next
Next
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 4 '07 #2

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

Similar topics

5
12084
by: Edlueze | last post by:
I use the CallByName function quite regularly, but the sub routines that I have always called have been located within the form code. The call I use looks something like this: Dim CallObjectForm...
12
11209
by: Jelle van Baardewijk | last post by:
Does anybody know if there's way to do this in C#? Jelle van Baardewijk
2
2476
by: MFRASER | last post by:
Is there any CallbyName function inside of C#. I need to shift my items in a collection Psuedo code aItem has hours 1-24 and I need to be able to shift the hours. foreach(MapItem aItem in...
1
2386
by: Kishor | last post by:
Hi all, I am facing one problem with callbyName. I am facing one problem, instead of describing this I am pasting this code. I wanted to know is there any other way to avoid this error and make...
8
6367
by: Rob R. Ainscough | last post by:
I use a generic Processing form (modal) where I pass it an object and method name and parameters if needed and then use CallbyName to execute the passed in method. What this does for me is lock...
0
1231
by: Phill. W | last post by:
I have a Console application (which will wind up running on a remote host). This has two Threads - the main processor and a second that provides a socket-based way of "talking" to the first. ...
1
1673
by: Fredrik Melin | last post by:
Hi, We had real bad problems with reports being printed wrong (active reports ..net 2.0), which we tracked down to being because before we printed the report we used CallByName to READ...
0
1213
by: Tim | last post by:
If I use CallByName, and the function that is called contains runtime errors, I don't get the code to pause and debug at the point of the error, rather at the callbyname line. This makes...
0
8827
by: penguinie | last post by:
First add to referance Microsoft.VisualBasic using System; using System.Collections.Generic; using System.Text; using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; ...
0
7237
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,...
0
7137
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
7347
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
7416
jinu1996
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...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5062
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...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
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...

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.