Click here to Skip to main content
15,909,518 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: baudrate Pin
Hrizip8-May-10 22:11
Hrizip8-May-10 22:11 
AnswerRe: RegKey Pin
Luc Pattyn8-May-10 9:46
sitebuilderLuc Pattyn8-May-10 9:46 
GeneralRe: RegKey Pin
Hrizip8-May-10 22:11
Hrizip8-May-10 22:11 
AnswerRe: CallbackWrapper Pin
Luc Pattyn8-May-10 9:50
sitebuilderLuc Pattyn8-May-10 9:50 
AnswerRe: overall Pin
Luc Pattyn8-May-10 9:57
sitebuilderLuc Pattyn8-May-10 9:57 
GeneralRe: overall Pin
Hrizip8-May-10 10:52
Hrizip8-May-10 10:52 
GeneralRe: overall Pin
Luc Pattyn8-May-10 11:04
sitebuilderLuc Pattyn8-May-10 11:04 
AnswerRe: Adapting a DLL to VB.NET, using PINVOKE Pin
Hrizip8-May-10 22:32
Hrizip8-May-10 22:32 
Fixed a few things;

1) Delegate is a system.delegate method so there was a problem in namespaces, had to explicitly state what a "DELEGATE" is (a system.delegate in this case)

2) Unresolved at this time, mostly because I am clueless when it comes to delegates Wink | ;)

This is the C# variant of one of the events/delegates:

public delegate void OnForceClose(int ErrorCode);




public event OnForceClose OnForceClose;



When expanded it reveals the following:


[MethodImpl(MethodImplOptions.Synchronized)]
public void add_OnForceClose(OnForceClose value)
{
    this.OnForceClose = (OnForceClose) Delegate.Combine(this.OnForceClose, value);
}

 [MethodImpl(MethodImplOptions.Synchronized)]
public void remove_OnForceClose(OnForceClose value)
{
    this.OnForceClose = (OnForceClose) Delegate.Remove(this.OnForceClose, value);
}




VB.net variant looks like this:

Public Custom Event OnForceClose As OnForceClose
 
MethodImpl(MethodImplOptions.Synchronized) _
Public Sub add_OnForceClose(ByVal value As OnForceClose)
    Me.OnForceClose = DirectCast(Delegate.Combine(Me.OnForceClose, value), OnForceClose)
End Sub

MethodImpl(MethodImplOptions.Synchronized) _
Public Sub remove_OnForceClose(ByVal value As OnForceClose)
    Me.OnForceClose = DirectCast(Delegate.Remove(Me.OnForceClose, value), OnForceClose)
End Sub


I have no idea what this does, I can make an educated guess and say that this delegate is "announced" by using an older routine that does not use "add handler", "remove handler" and "raiseevent" instead it plugs into an older system.delegate method and therefore uses a different way of adding and removing a handler (see c# example).

The VB example seems to show how to splice two delegates (or events) into one by the means of system.delegate.combine method, I have no idea why this is used in this example and what it should accomplish.

I would need to find out what the difference is between the above mentioned examples and the addhandler/removehandler/raiseevent (which I am partly familiar with) and then try to recreate the whole thing.

Any help/insight would be most welcome.
GeneralRe: Adapting a DLL to VB.NET, using PINVOKE Pin
Luc Pattyn9-May-10 1:57
sitebuilderLuc Pattyn9-May-10 1:57 
GeneralRe: Adapting a DLL to VB.NET, using PINVOKE Pin
Hrizip9-May-10 2:38
Hrizip9-May-10 2:38 
AnswerRe: Adapting a DLL to VB.NET, using PINVOKE Pin
Hrizip12-May-10 23:54
Hrizip12-May-10 23:54 
QuestionHow could I debug the connection process of a COM AddIn Pin
Sonhospa8-May-10 8:12
Sonhospa8-May-10 8:12 
AnswerRe: How could I debug the connection process of a COM AddIn Pin
Luc Pattyn8-May-10 8:40
sitebuilderLuc Pattyn8-May-10 8:40 
GeneralRe: How could I debug the connection process of a COM AddIn Pin
Sonhospa8-May-10 12:26
Sonhospa8-May-10 12:26 
GeneralRe: How could I debug the connection process of a COM AddIn Pin
Luc Pattyn8-May-10 12:33
sitebuilderLuc Pattyn8-May-10 12:33 
GeneralRe: How could I debug the connection process of a COM AddIn Pin
Sonhospa8-May-10 13:09
Sonhospa8-May-10 13:09 
GeneralRe: How could I debug the connection process of a COM AddIn Pin
Luc Pattyn8-May-10 13:28
sitebuilderLuc Pattyn8-May-10 13:28 
NewsRe: How could I debug the connection process of a COM AddIn Pin
Sonhospa10-May-10 5:04
Sonhospa10-May-10 5:04 
Questionmanage 2 sim in my mobile phone Pin
Joshua828-May-10 7:24
Joshua828-May-10 7:24 
AnswerRe: manage 2 sim in my mobile phone Pin
Dave Kreskowiak8-May-10 13:33
mveDave Kreskowiak8-May-10 13:33 
GeneralRe: manage 2 sim in my mobile phone Pin
Joshua829-May-10 23:04
Joshua829-May-10 23:04 
GeneralRe: manage 2 sim in my mobile phone Pin
Dave Kreskowiak10-May-10 2:19
mveDave Kreskowiak10-May-10 2:19 
QuestionTrying to override a protected method in DataGridView [Answered] Pin
kepatter7-May-10 5:19
professionalkepatter7-May-10 5:19 
AnswerRe: Trying to override a protected method in DataGridView Pin
Alan N7-May-10 6:56
Alan N7-May-10 6:56 
AnswerRe: Trying to override a protected method in DataGridView Pin
William Winner7-May-10 7:14
William Winner7-May-10 7:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.