-
Jun 5th, 2013, 09:50 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Using Callbacks
Hi,
I hope no one minds, but I figured I would create a new thread since my topic and question changed in my previous one.
I am not working with Callbacks and still very unsure of how they work.
I looked over the Sample here ---> http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx but it does not all make sense.
I have a module in my 2nd project like so.
vb.net Code:
Module ModuleSend Public Delegate Sub CallKey() Public SendCallBack As CallKey = Nothing Public Sub Invoke() Try If Not SendCallBack Is Nothing Then SendCallBack.Invoke() End If Catch End Try End Sub End Module
Now I want to be able use this in the main project
vb.net Code:
ModuleSend.SendKeyCallBack = AddressOf Main.Do
But even though SendKeyCallBack is declared in the module it says it is not declared. any ideas?
Last edited by Crzyrio; Jun 5th, 2013 at 02:15 PM.
-
Jun 5th, 2013, 10:10 AM
#2
New Member
Re: Using Callbacks
Sorry, I don't know much about callbacks but, why is the "Public SendKeyCallBack As CallSendKey = Nothing" ? Looking through the link you posted above it doesn't say anything about any code like that, maybe this is where your problem lies? Or maybe because "CallSendKey" is set to nothing.
-
Jun 5th, 2013, 10:15 AM
#3
Thread Starter
Addicted Member
Re: Using Callbacks
Originally Posted by DamnNation
Sorry, I don't know much about callbacks but, why is the "Public SendKeyCallBack As CallSendKey = Nothing" ? Looking through the link you posted above it doesn't say anything about any code like that, maybe this is where your problem lies? Or maybe because "CallSendKey" is set to nothing.
Even when it is set to something it is the same problem.
EDIT: Silly me, forgot to make the Module public :P
Last edited by Crzyrio; Jun 5th, 2013 at 10:21 AM.
-
Jun 5th, 2013, 10:33 AM
#4
Re: Using Callbacks
Modules default to "Friend" in VB.Net, so if you're trying to reference something in it from another project in the solution, it will not be able to resolve it.
-
Jun 5th, 2013, 02:15 PM
#5
Thread Starter
Addicted Member
Re: Using Callbacks
Originally Posted by Niya
Modules default to "Friend" in VB.Net, so if you're trying to reference something in it from another project in the solution, it will not be able to resolve it.
Thank You very much Changing it to public solved the problem and I did not know they defaulted to Friend in vb!
Call backs are an interesting tool.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|