I countinue to discover problems for simple tasks. Now I would like to
write code, Sub or Function, where some values (more than 1) are
calculated and are to be assigned to the variables which names I would
like to submit as arguments to this SUB /Function
How to do this.
--
Vlad. Moltchanov 7 1254
Use the ByRef option in the arguments list of the function. Perform your
calculations, set the new values, and your calling function can then use the
new values of the variables.
Mike Storr www.veraccess.com
<vl************ ******@ktl.fi> wrote in message
news:40******** *******@ktl.fi. .. I countinue to discover problems for simple tasks. Now I would like to write code, Sub or Function, where some values (more than 1) are calculated and are to be assigned to the variables which names I would like to submit as arguments to this SUB /Function How to do this.
-- Vlad. Moltchanov vl************* *****@ktl.fi wrote: I countinue to discover problems for simple tasks. Now I would like to write code, Sub or Function, where some values (more than 1) are calculated and are to be assigned to the variables which names I would like to submit as arguments to this SUB /Function How to do this.
Something looking like?
sub setValues(name1 , value1, name2, value2)
(name1) = value1
(name2) = value2
end sub
?
I think that is not possible. Moreover, the variables assigned to must
be global, or at least with a scope larger than the sub itself--why use
such global variables? Can't you use a table, say Settings(settin gName,
settingValue)?
--
Bas Cost Budde http://www.heuveltop.org/BasCB
but the domain is nl
Bas Cost Budde <ba*@heuveltop. org> wrote in
news:c0******** ***@news2.solco n.nl: vl************* *****@ktl.fi wrote:
I countinue to discover problems for simple tasks. Now I would like to write code, Sub or Function, where some values (more than 1) are calculated and are to be assigned to the variables which names I would like to submit as arguments to this SUB /Function How to do this.
Something looking like?
sub setValues(name1 , value1, name2, value2) (name1) = value1 (name2) = value2 end sub
?
I think that is not possible. Moreover, the variables assigned to must be global, or at least with a scope larger than the sub itself--why use such global variables? Can't you use a table, say Settings(settin gName, settingValue)?
Eh?
If you pass ByRef (the default), then the values will work.
Call your sub thusly:
Dim OutsideVariable 1
Dim OutsideVariable 2
setValues OutsideVariable 1, "foo", OutsideVariable 2, "bar"
Debug.Print OutsideVariable 1 & " " & OutsideVariable 2
will return:
foo bar
in the debug window.
That's how you can get multiple values returned from a sub/function,
by passing variables by reference that are written to within the
sub/function.
This is a basic technique of VB.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
David W. Fenton wrote: Bas Cost Budde <ba*@heuveltop. org> wrote in
I think that is not possible.
Eh?
Exactly! Eh? I COMPLETELY misunderstood the question. Sorry about that,
happily I'm not the only one in the team.
--
Bas Cost Budde http://www.heuveltop.org/BasCB
but the domain is nl
Bas Cost Budde <ba*@heuveltop. org> wrote in
news:c0******** **@news2.solcon .nl: David W. Fenton wrote:
Bas Cost Budde <ba*@heuveltop. org> wrote in
I think that is not possible.
Eh?
Exactly! Eh? I COMPLETELY misunderstood the question. Sorry about that, happily I'm not the only one in the team.
Well, it's also possible *you* understood it and *I* didn't!
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Thanks to all having replied.
The idea of ByRef became much more clear. However, my task was to make
an Access analog of SAS macro taking as an argument string like "name1
name2 ... name5" (number of names is not fixed) and generating
variables
name1 name2 ... name5 with, say, consequitive random numbers. vl************* *****@ktl.fi wrote: I countinue to discover problems for simple tasks. Now I would like to write code, Sub or Function, where some values (more than 1) are calculated and are to be assigned to the variables which names I would like to submit as arguments to this SUB /Function How to do this.
-- Vlad. Moltchanov
--
Vladislav Moltchanov Ph.D.
National Public Health Institute
Dept. of Epidemiology and Health Promotion
Mannerheimintie 166, 00300 Helsinki, Finland
Tel: +358 9 4744 8644
Fax: +358 9 4744 8338
On Mon, 09 Feb 2004 16:59:26 +0200, vl************* *****@ktl.fi wrote: I countinue to discover problems for simple tasks. Now I would like to write code, Sub or Function, where some values (more than 1) are calculated and are to be assigned to the variables which names I would like to submit as arguments to this SUB /Function How to do this.
Are you sure what you're talking about isn't best simply handled with arrays
or collections? Parsing the names of things at run-time just to get numbered
lists is very inefficient, to the extent it's possible at all. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mayer |
last post by:
Hello:
Is there a way to see at the python prompt the names of all the public
methods of a class or the names exported by a module? I know that
GUI-based IDEs have a nifty way of displaying these in the form of a
drop-down list, but I'm looking for some function or method that will
simply return a list of strings.
Thanks,
|
by: James |
last post by:
Hi,
I am finding it increasingly difficult to name my variables.
I am not able to think in the right way.
Expert C programmers please Help.
Regards,
|
by: Russ Chinoy |
last post by:
Hi,
This may be a totally newbie question, but I'm stumped.
If I have a function such as:
function DoSomething(strVarName) {
.....
}
|
by: Mike Meyer |
last post by:
It seems that the distinction between tuples and lists has slowly been
fading away. What we call "tuple unpacking" works fine with lists on
either side of the assignment, and iterators on the values side. IIRC,
"apply" used to require that the second argument be a tuple; it now
accepts sequences, and has been depreciated in favor of *args, which
accepts not only sequences but iterators.
Is there any place in the language that still...
|
by: Noah |
last post by:
Is there a simple way to get a dictionary of
argument names and their default values for
a method or function? I came up with one solution, but
I feel like Python must have a simpler way.
Python provide a way to get a sequence of
argument names and a different way to get a
sequence of default argument values. Since
default values have to come at the end of an
argument list you can match up the values in the
| |
by: Shawnk |
last post by:
I would like to get the class INSTANCE name (not type name) of an
'object'.
I can get the object (l_obj_ref.GetType()) and then get the
(l_obj_typ.Name) for the class name.
I there any way of getting 'l_Fred_my_ins' out of the following.
....
My_cls l_Fred_my_ins = new My_cls();
|
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in C# in some
way? Or maybe no, because it is similar to a global variable (with its
scope restricted) which C# is dead against?
Zytan
|
by: David Veeneman |
last post by:
Should a member variable be passed to a private method in the same class as
a method argument, or should the method simply call the member variable?
For years, I have passed member variables to private methods in the same
class as method arguments. For example, if Public method Foo() calls private
method Bar(), and if Bar() uses member variable m_MyVariable, I declare the
private method with the signature:
private void Bar(SomeType...
|
by: amygdala |
last post by:
Hi all,
I'm starting this new project in which I'ld like to implement sort of a
design pattern I have seen being used in the CodeIgniter framework.
Basically, the site will examine the URI and based on the segments of the
URI it will fire up some controller class, for instance, say I have an inbox
in which end-users can view messages they got from other users, they'ld
start at:
|
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,...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |