473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Passing an address as an argument

I have these three statements:

gFormCheckForCancel = New FormCheckForCancel

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

gFormCheckForCancel.ShowForm()

I'd like to move

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

to ShowForm()

and pass

AddressOf UserCancelled

as an argument of ShowForm()

But I don't know how.

Can someone tell me?


Nov 21 '05 #1
5 1102
Hi,

Take a look at delegates

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-------------------------
" Just Me" <gr****@a-znet.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
I have these three statements:

gFormCheckForCancel = New FormCheckForCancel

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

gFormCheckForCancel.ShowForm()

I'd like to move

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

to ShowForm()

and pass

AddressOf UserCancelled

as an argument of ShowForm()

But I don't know how.

Can someone tell me?

Nov 21 '05 #2
I know a little about them. I've even used MouseEventHandler in a similar
situation.
But do not know what to use here.
Thanks

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

Take a look at delegates

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-------------------------
" Just Me" <gr****@a-znet.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
I have these three statements:

gFormCheckForCancel = New FormCheckForCancel

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

gFormCheckForCancel.ShowForm()

I'd like to move

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

to ShowForm()

and pass

AddressOf UserCancelled

as an argument of ShowForm()

But I don't know how.

Can someone tell me?


Nov 21 '05 #3
I think I found how to do it. Seems
Public Event Cancelled(ByVal sender As Object, ByVal e As EventArgs)

creates a type CancelledEventHandler.

I still do not understand some things.

I believe Cancelled, as defined above, is a delegate, but

is it a class or a type.

Help sometimes seems to use delegate as a class and sometimes as a type.

I don't understand when a delegate is a class and when it is a type.

Thanks



" Just Me" <gr****@a-znet.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I know a little about them. I've even used MouseEventHandler in a similar
situation.
But do not know what to use here.
Thanks

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

Take a look at delegates

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-------------------------
" Just Me" <gr****@a-znet.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
I have these three statements:

gFormCheckForCancel = New FormCheckForCancel

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

gFormCheckForCancel.ShowForm()

I'd like to move

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

to ShowForm()

and pass

AddressOf UserCancelled

as an argument of ShowForm()

But I don't know how.

Can someone tell me?



Nov 21 '05 #4
Hi,

Declare a delegate sub and pass a variable of the delegate sub name.
public delegate sub MySub(byval Arg1 as integer)

dim MyAddressOf as new mysub(addressof theSub)

Ken
-------------------------

"Just Me" wrote:
I think I found how to do it. Seems
Public Event Cancelled(ByVal sender As Object, ByVal e As EventArgs)

creates a type CancelledEventHandler.

I still do not understand some things.

I believe Cancelled, as defined above, is a delegate, but

is it a class or a type.

Help sometimes seems to use delegate as a class and sometimes as a type.

I don't understand when a delegate is a class and when it is a type.

Thanks



" Just Me" <gr****@a-znet.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I know a little about them. I've even used MouseEventHandler in a similar
situation.
But do not know what to use here.
Thanks

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

Take a look at delegates

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-------------------------
" Just Me" <gr****@a-znet.com> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl...
I have these three statements:

gFormCheckForCancel = New FormCheckForCancel

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

gFormCheckForCancel.ShowForm()

I'd like to move

AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled

to ShowForm()

and pass

AddressOf UserCancelled

as an argument of ShowForm()

But I don't know how.

Can someone tell me?




Nov 21 '05 #5
thanks

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
Hi,

Declare a delegate sub and pass a variable of the delegate sub
name.
public delegate sub MySub(byval Arg1 as integer)

dim MyAddressOf as new mysub(addressof theSub)

Ken
-------------------------

"Just Me" wrote:
I think I found how to do it. Seems
Public Event Cancelled(ByVal sender As Object, ByVal e As EventArgs)

creates a type CancelledEventHandler.

I still do not understand some things.

I believe Cancelled, as defined above, is a delegate, but

is it a class or a type.

Help sometimes seems to use delegate as a class and sometimes as a type.

I don't understand when a delegate is a class and when it is a type.

Thanks



" Just Me" <gr****@a-znet.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
>I know a little about them. I've even used MouseEventHandler in a
>similar
>situation.
> But do not know what to use here.
>
>
> Thanks
>
> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
> news:%2***************@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> Take a look at delegates
>>
>> http://msdn.microsoft.com/library/de...classtopic.asp
>>
>> Ken
>> -------------------------
>> " Just Me" <gr****@a-znet.com> wrote in message
>> news:e4**************@TK2MSFTNGP10.phx.gbl...
>> I have these three statements:
>>
>> gFormCheckForCancel = New FormCheckForCancel
>>
>> AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled
>>
>> gFormCheckForCancel.ShowForm()
>>
>>
>>
>> I'd like to move
>>
>> AddHandler gFormCheckForCancel.Cancelled, AddressOf UserCancelled
>>
>> to ShowForm()
>>
>> and pass
>>
>> AddressOf UserCancelled
>>
>> as an argument of ShowForm()
>>
>>
>>
>> But I don't know how.
>>
>> Can someone tell me?
>>
>>
>>
>>
>>
>
>


Nov 21 '05 #6

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

Similar topics

3
by: Anon Email | last post by:
Hi people, In the following code, in the main method, why is it possible to pass "input" as an argument to the method TheCalculator.Execute()? This method is supposed to accept references to...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
1
by: Foxy Kav | last post by:
Hi everyone, im a first year UNI student doing a programming subject and im stuck on how to get rid of my global variables, char stringarray and char emptystring. I was wondering if anyone could...
6
by: Adrian | last post by:
I am trying to pass the address of a C++ function into a Fortran routine to enable the Fortran routine to call this C++ function. I have to do it this way as our build process does not allow...
3
by: Goh, Yong Kwang | last post by:
I'm trying to create a function that given a string, tokenize it and put into a dynamically-sized array of char* which is in turn also dynamically allocated based on the string token length. I...
7
by: Jeff K | last post by:
Can you pass an int array by reference to a function and modify selective elements? Here is my code: #include <stdio.h> #define COLUMNSIZE 30 #define ASIZE 5...
17
by: LP | last post by:
Hello, Here's the scenario: Object A opens a Sql Db connection to execute number of SqlCommands. Then it needs to pass this connection to a constructor of object B which in turn executes more...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
8
by: S. | last post by:
Hi all, Can someone please help me with this? I have the following struct: typedef struct { char *name; int age; } Student;
18
by: sanjay | last post by:
Hi, I have a doubt about passing values to a function accepting string. ====================================== #include <iostream> using namespace std; int main() {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.