473,403 Members | 2,323 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,403 software developers and data experts.

Passing a Sun address

Now I do

SyatemSub(AddressOf Somesub)
I want to define a sub as follows
Sub2(???)
SystemSub(???)
End Sub

And call it thus:
Sub2 (Address of SomeSub)

Can I do that?
Nov 21 '05 #1
2 1869
**Developer**
Do you mean you want to do something like:

' Define what some sub should look like
Public Delegate Sub ASub(ByVal value As Integer)

Public Sub Main()
' pass the "address" of SomeSub
Sub2(AddressOf SomeSub)
End Sub

Public Sub Sub2(ByVal asub As ASub)
' we already have the "Address" so just pass it
SystemSub(asub)
End Sub

Public Sub SystemSub(ByVal asub As ASub)
asub.Invoke(10)

' Invoke is optional, so you can also use:
asub(10)

End Sub

Public Sub SomeSub(ByVal value As Integer)
' Do something exciting with value.
End Sub
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
" **Developer**" <RE*************@a-znet.com> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
| Now I do
|
| SyatemSub(AddressOf Somesub)
|
|
| I want to define a sub as follows
|
|
| Sub2(???)
| SystemSub(???)
| End Sub
|
| And call it thus:
| Sub2 (Address of SomeSub)
|
| Can I do that?
|
|
Nov 21 '05 #2
Yes

It took a while because the SystenSub I had in mind was
Dim t As New Thread(?)

Now I know your example applies since there is a Delegate (ThreadStart) that
I can use.

Thanks

Public Shared Function MakeAbortThread(ByVal threadCode As ThreadStart...)
As Thread

Dim t As New Thread(threadCode)

t.Start()

-snip-

Return t

End Function

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:ec**************@TK2MSFTNGP09.phx.gbl...
**Developer**
Do you mean you want to do something like:

' Define what some sub should look like
Public Delegate Sub ASub(ByVal value As Integer)

Public Sub Main()
' pass the "address" of SomeSub
Sub2(AddressOf SomeSub)
End Sub

Public Sub Sub2(ByVal asub As ASub)
' we already have the "Address" so just pass it
SystemSub(asub)
End Sub

Public Sub SystemSub(ByVal asub As ASub)
asub.Invoke(10)

' Invoke is optional, so you can also use:
asub(10)

End Sub

Public Sub SomeSub(ByVal value As Integer)
' Do something exciting with value.
End Sub
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net

Nov 21 '05 #3

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

Similar topics

12
by: harry | last post by:
I have an object that's passed in to a function as a parameter i.e public boolean getProjectTitle(ProjectHeader_DTO obj) {...} If I then call a method on this object inside the function i.e...
6
by: Mike Guerrieri | last post by:
I have a few objects that I've created, Contact, Address, AddressCollection (inherits from CollectionBase), dtaContact, and dtaAddress. One of the properties of the Contact object...
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...
6
by: dharmadam | last post by:
Is it possible to pass a column name or the order of the column name in the DB2 table table function. For example, I want to update the address of a person by passing one of the address column name...
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...
61
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But...
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);
3
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
0
by: bluefootedpig | last post by:
hello, I'm wondering about passing in an xml file to an xslt document, i need need to querry the document for values. File1.xml <root> <address> ...data.... </address> </root>
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;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
agi2029
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,...

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.