472,791 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Module Control Addressing in VB.Net

Good evening all,

I am going crazy with a problem that I am sure has a simple solution.

I need to add items to a ComboBox on a Form. I can do it simply when I
code on form.vb, but when go to a procedure on a seperate module it says
"Name 'ComboBox' is not declared". I have tried setting the modifiers
for the ComboBox to Public, Friend and Private all to no avail. I am
also not sure why on the main page "Me." is used before a control, I
tried this on the module but it didn't work.

Any help you may be able to provide would be much appreciated as I am
still trying to learn this language.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 3693
Hello,

"Brent McIntyre" <br************@aep.salvationarmy.org> schrieb:
I am going crazy with a problem that I am sure has a simple
solution.

I need to add items to a ComboBox on a Form. I can
do it simply when I code on form.vb, but when go to
a procedure on a seperate module it says "Name
'ComboBox' is not declared".


You must pass a reference to the control, for example in a parameter:

\\\
Imports System.Windows.Forms

Public Module MyModule
Public Sub Bla(ByVal Foo As ComboBox)
Foo.Items.Add(...)
End Sub
End Module
///

Usage (in the form):

\\\
MyModule.Bla(Me.ComboBox1)
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2
OOP is a bitch sometimes. Herfried is exactly right. You really have
to watch that cause variables are objects aswell.

The only thing I've never figured out is in an MDI environment, how to
reference one child from another LOL

Just remember, everything's an object and all objects have to be
referenced/declared somewhere somehow :)

Tibby
"Brent McIntyre" <br************@aep.salvationarmy.org> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Good evening all,

I am going crazy with a problem that I am sure has a simple solution.

I need to add items to a ComboBox on a Form. I can do it simply when I
code on form.vb, but when go to a procedure on a seperate module it says
"Name 'ComboBox' is not declared". I have tried setting the modifiers
for the ComboBox to Public, Friend and Private all to no avail. I am
also not sure why on the main page "Me." is used before a control, I
tried this on the module but it didn't work.

Any help you may be able to provide would be much appreciated as I am
still trying to learn this language.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3
"Brent McIntyre" <br************@aep.salvationarmy.org> schrieb
I am going crazy with a problem that I am sure has a simple
solution.

I need to add items to a ComboBox on a Form. I can do it simply when
I code on form.vb, but when go to a procedure on a seperate module it
says "Name 'ComboBox' is not declared". I have tried setting the
modifiers for the ComboBox to Public, Friend and Private all to no
avail. I am also not sure why on the main page "Me." is used before
a control, I tried this on the module but it didn't work.

Any help you may be able to provide would be much appreciated as I
am still trying to learn this language.


The Combobox is a property of the Form. If you want to access a property of
an object, you need a reference to the object. If you don't have a reference
you have to pass it to the Module.
--
Armin

Nov 20 '05 #4

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

Similar topics

2
by: Kenneth McDonald | last post by:
I'd like to propose a new PEP , for a standard library module that deals with files and file paths in an object oriented manner. I believe this module should be included as part of the standard...
22
by: Luke | last post by:
Elements with name attribute: form, input, textarea, a, frame, iframe, button, select, map, meta, applet, object, param, img (if you know more reply...) Methods of addresing html elements:...
11
by: Tony Williams | last post by:
I have a module called GetDocIndex which calculates a sequential number in a control called CommDocNbrtxt. On the BeforeUpdate property of the form I have the following code Private Sub...
1
by: S. van Beek | last post by:
Dear reader, In case an application is ussing an external model library you have to address this external model library in your application. This addressing takes place in a module of the...
6
by: Valerie Hough | last post by:
I'm not entirely sure what the difference is between these two approaches. In order to avoid reentrant code, I was using Control.BeginInvoke in my UI to cause an asynchronous activity to be done...
0
by: Stefan Lischke | last post by:
Hi, I'm really desperate using code generation(wsdl.exe) from wsdl files for latest WS-Eventing(including WS-Addressing) Specs. I'm writing my diploma about "publish subscribe systems based on...
0
by: gerritmitchell | last post by:
Hi, I have a situation where I need to send a SOAP message from a receiver through multiple intermediaries and then to an ultimate receiver. The intial sender will tell the intermediary where...
1
by: =?Utf-8?B?dWx0cmFuZXQ=?= | last post by:
We have a client that uses .Net that needs to work against our Java (xfire) based WS. My question is: how can a .Net (C#) WS client be configured to not send WS-Addressing headers? The client in...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.