🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #611

Re: Is it possible in VB 5 ? I do not think so, What do you think?

#611
From: Kerry
Date: Thu, 27 Nov 1997 00:00
38 lines
2306 bytes


Joachim Flodqvist <joachim@ecs.se> wrote in article
<347C359A.1FEA@ecs.se>...
> John Chen wrote:
> > 
> > 1) Can you  put a function or sub name in a varible and then evaluate
the
> > variant  so it will run the function or sub ?? ??
> >         dim strFuncName as string
> >         strFuncName = "test"
> >         how do you call function test ?? ( the function has to be in a
varible)
> > 
> >         function test() as integer
> >                 return 4
> >         end function
> 
A couple of ideas come to mind.....
Why not just use a Select Case statement 

Select Case strFuncName

Case "test"
	a = test
Case "Command1_Click"
	Call Command1_Click
etc...

End Select

or in VB5 you could use an Event, you could evaluate your string and raise
a specified event and your 'Class' (function with attitude) could watch for
its event to be triggered. Theres a good article on it in the November(?)
Visual Basic Programmers Journal.

.rko
Technical Details
Message-ID: <01bcfaf0$475cf260$1d0f32cc@PedestrianX.canuck.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bcf963$5aa850f0$e33bd4cc@ntmain> <347C359A.1FEA@ecs.se>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1053fc,61c438cbc70e4437,start
X-Google-Attributes: gid1053fc,public
X-Google-Thread: 10c949,61c438cbc70e4437,start
X-Google-Attributes: gid10c949,public
X-Google-Thread: 10be7f,61c438cbc70e4437,start
X-Google-Attributes: gid10be7f,public
X-Google-Thread: 104586,61c438cbc70e4437,start
X-Google-Attributes: gid104586,public
X-Google-Thread: 110e3b,61c438cbc70e4437,start
X-Google-Attributes: gid110e3b,public
X-Google-Thread: f5f6f,61c438cbc70e4437,start
X-Google-Attributes: gidf5f6f,public
X-Google-Thread: 1143a7,61c438cbc70e4437,start
X-Google-Attributes: gid1143a7,public
X-Google-Thread: 10ab99,61c438cbc70e4437,start
X-Google-Attributes: gid10ab99,public
From: "Kerry" <kerry@canuck.com>
Subject: Re: Is it possible in VB 5 ? I do not think so, What do you think?
Date: 1997/11/27
Message-ID: <01bcfaf0$475cf260$1d0f32cc@PedestrianX.canuck.com>
X-Deja-AN: 293056750
References: <01bcf963$5aa850f0$e33bd4cc@ntmain> <347C359A.1FEA@ecs.se>
Organization: Canada Connect Corp.
Newsgroups: alt.lang.basic,comp.lang.basic.misc,comp.lang.basic.visual.3rdparty,comp.lang.basic.visual.database,comp.lang.basic.visual.misc,es.comp.lenguajes.visual-basic,microsoft.public.vb.database,microsoft.public.vb.database.dao,microsoft.public.vb.databa