PC Review


Reply
Thread Tools Rate Thread

Adding an event handler in a sub

 
 
Just Me
Guest
Posts: n/a
 
      9th Aug 2004
I need to create a library sub that adds event handlers to a control.
Public Shared Sub AddEvent(ByVal qq As Control, By?? ControlMouseMove As ??)

So I need to pass the address of the handler or equivalent so that I can

AddHandler qq.MouseMove, AddressOf ControlMouseMove



Anyone know how to do that?





Thanks


 
Reply With Quote
 
 
 
 
Craig Vick [MSFT]
Guest
Posts: n/a
 
      13th Aug 2004
You can do something like

Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
AddHandler qq.MouseMove, handler
End Sub

You would call it like this:

Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
AddEvent(Button1, eHandler)

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
>From: " Just Me" <(E-Mail Removed)>
>Subject: Adding an event handler in a sub
>Date: Mon, 9 Aug 2004 11:40:36 -0400
>Lines: 18
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: h30.d169b8.dial.xtelegent.net 209.105.184.30
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:221942
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb
>
>I need to create a library sub that adds event handlers to a control.
>Public Shared Sub AddEvent(ByVal qq As Control, By?? ControlMouseMove As ??)
>
>So I need to pass the address of the handler or equivalent so that I can
>
>AddHandler qq.MouseMove, AddressOf ControlMouseMove
>
>
>
>Anyone know how to do that?
>
>
>
>
>
>Thanks
>
>
>



 
Reply With Quote
 
Just Me
Guest
Posts: n/a
 
      14th Aug 2004
Thanks. I tried it and it works great.

Craig, I know you know something about the RichTextBox so I'd appreciate it
if you'd take a minute to read my last post under Using Regular Expressions
with a RichTextBox, Aug 11.

Should I just forget it!

No one seems to know anything about it.

Even a hint as to where I can go to get more info would be greatly
appreciated.

I've been looking for some time now.

Thanks again for the reply below.



"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
news:(E-Mail Removed)...
> You can do something like
>
> Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
> AddHandler qq.MouseMove, handler
> End Sub
>
> You would call it like this:
>
> Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
> AddEvent(Button1, eHandler)
>
> Craig VB.Net Team
> --------------------------------------------------------------------
> This reply is provided AS IS, without warranty (express or implied).
> --------------------



 
Reply With Quote
 
Just Me
Guest
Posts: n/a
 
      14th Aug 2004
Thanks. I tried it and it works great.

Craig, I know you know something about the RichTextBox so I'd appreciate it
if you'd take a minute to read my last post under Using Regular Expressions
with a RichTextBox, 8/12/2004 8.54 AM

Should I just forget it!

No one seems to know anything about it.

Even a hint as to where I can go to get more info would be greatly
appreciated.

I've been looking for some time now.

Thanks again for the reply below.



"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
news:(E-Mail Removed)...
> You can do something like
>
> Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
> AddHandler qq.MouseMove, handler
> End Sub
>
> You would call it like this:
>
> Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
> AddEvent(Button1, eHandler)
>
> Craig VB.Net Team
> --------------------------------------------------------------------
> This reply is provided AS IS, without warranty (express or implied).
> --------------------




 
Reply With Quote
 
Craig Vick [MSFT]
Guest
Posts: n/a
 
      20th Aug 2004
I don't know a lot about the RichTextBox, but from what I can gather in the documentation, this isn't directly supported. Here's a url, however, that may help.

http://www.knowdotnet.com/articles/r...chtextbox.html

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
>From: " Just Me" <(E-Mail Removed)>
>References: <(E-Mail Removed)> <(E-Mail Removed)>
>Subject: Re: Adding an event handler in a sub
>Date: Sat, 14 Aug 2004 09:19:09 -0400
>Lines: 39
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <uXB#(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: h26.d169bd.dial.xtelegent.net 209.105.189.26
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:222957
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb
>
>Thanks. I tried it and it works great.
>
>Craig, I know you know something about the RichTextBox so I'd appreciate it
>if you'd take a minute to read my last post under Using Regular Expressions
>with a RichTextBox, 8/12/2004 8.54 AM
>
>Should I just forget it!
>
>No one seems to know anything about it.
>
>Even a hint as to where I can go to get more info would be greatly
>appreciated.
>
>I've been looking for some time now.
>
>Thanks again for the reply below.
>
>
>
>"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
>news:(E-Mail Removed)...
>> You can do something like
>>
>> Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
>> AddHandler qq.MouseMove, handler
>> End Sub
>>
>> You would call it like this:
>>
>> Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
>> AddEvent(Button1, eHandler)
>>
>> Craig VB.Net Team
>> --------------------------------------------------------------------
>> This reply is provided AS IS, without warranty (express or implied).
>> --------------------

>
>
>
>


Thanks & Regards
Santhosh Somayajulu
Internet Information Services Team,
Microsoft


 
Reply With Quote
 
Just Me
Guest
Posts: n/a
 
      21st Aug 2004
Thanks for the reply. I had seen that page but he works on the text property
rather that the box doing it.
I don't know what documentation you've seen but if you search for
tommatchpattern you find things like:

STDMETHODIMP FindTextEnd( BSTR bstr,
long Count,
long Flags,
long *pLength
);
Parameters
--snip--
Flags
Flags governing comparisons.
It can be zero (the default) or any combination of the following values.
tomMatchWord 2 Matches whole words.
tomMatchCase 4 Matches case.
tomMatchPattern 8 Matches regular expressions.

--snip--

Thanks again



"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
news:(E-Mail Removed)...
> I don't know a lot about the RichTextBox, but from what I can gather in

the documentation, this isn't directly supported. Here's a url, however,
that may help.
>
> http://www.knowdotnet.com/articles/r...chtextbox.html
>
> Craig VB.Net Team
> --------------------------------------------------------------------
> This reply is provided AS IS, without warranty (express or implied).
>
> --------------------
> >From: " Just Me" <(E-Mail Removed)>
> >References: <(E-Mail Removed)>

<(E-Mail Removed)>
> >Subject: Re: Adding an event handler in a sub
> >Date: Sat, 14 Aug 2004 09:19:09 -0400
> >Lines: 39
> >X-Priority: 3
> >X-MSMail-Priority: Normal
> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> >Message-ID: <uXB#(E-Mail Removed)>
> >Newsgroups: microsoft.public.dotnet.languages.vb
> >NNTP-Posting-Host: h26.d169bd.dial.xtelegent.net 209.105.189.26
> >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
> >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:222957
> >X-Tomcat-NG: microsoft.public.dotnet.languages.vb
> >
> >Thanks. I tried it and it works great.
> >
> >Craig, I know you know something about the RichTextBox so I'd appreciate

it
> >if you'd take a minute to read my last post under Using Regular

Expressions
> >with a RichTextBox, 8/12/2004 8.54 AM
> >
> >Should I just forget it!
> >
> >No one seems to know anything about it.
> >
> >Even a hint as to where I can go to get more info would be greatly
> >appreciated.
> >
> >I've been looking for some time now.
> >
> >Thanks again for the reply below.
> >
> >
> >
> >"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
> >news:(E-Mail Removed)...
> >> You can do something like
> >>
> >> Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
> >> AddHandler qq.MouseMove, handler
> >> End Sub
> >>
> >> You would call it like this:
> >>
> >> Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
> >> AddEvent(Button1, eHandler)
> >>
> >> Craig VB.Net Team
> >> --------------------------------------------------------------------
> >> This reply is provided AS IS, without warranty (express or implied).
> >> --------------------

> >
> >
> >
> >

>
> Thanks & Regards
> Santhosh Somayajulu
> Internet Information Services Team,
> Microsoft
>
>



 
Reply With Quote
 
Craig Vick [MSFT]
Guest
Posts: n/a
 
      3rd Sep 2004
As far as I can see, the .Net RichTextBox doesn't expose anything like this (it would be nice if it did). The API below maybe for another RichTextBox control
(though I looked at the VB6 control, and it didn't support this either).

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
>From: " Just Me" <(E-Mail Removed)>
>References: <(E-Mail Removed)> <(E-Mail Removed)> <uXB#KFggEHA.3676

@TK2MSFTNGP12.phx.gbl> <(E-Mail Removed)>
>Subject: Re: Adding an event handler in a sub
>Date: Fri, 20 Aug 2004 22:14:22 -0400
>Lines: 106
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <#(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: h121.d169bd.dial.xtelegent.net 209.105.189.121
>Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:224838
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb
>
>Thanks for the reply. I had seen that page but he works on the text property
>rather that the box doing it.
>I don't know what documentation you've seen but if you search for
>tommatchpattern you find things like:
>
>STDMETHODIMP FindTextEnd( BSTR bstr,
> long Count,
> long Flags,
> long *pLength
>);
>Parameters
>--snip--
>Flags
>Flags governing comparisons.
>It can be zero (the default) or any combination of the following values.
>tomMatchWord 2 Matches whole words.
>tomMatchCase 4 Matches case.
>tomMatchPattern 8 Matches regular expressions.
>
>--snip--
>
>Thanks again
>
>
>
>"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
>news:(E-Mail Removed)...
>> I don't know a lot about the RichTextBox, but from what I can gather in

>the documentation, this isn't directly supported. Here's a url, however,
>that may help.
>>
>> http://www.knowdotnet.com/articles/r...chtextbox.html
>>
>> Craig VB.Net Team
>> --------------------------------------------------------------------
>> This reply is provided AS IS, without warranty (express or implied).
>>
>> --------------------
>> >From: " Just Me" <(E-Mail Removed)>
>> >References: <(E-Mail Removed)>

><(E-Mail Removed)>
>> >Subject: Re: Adding an event handler in a sub
>> >Date: Sat, 14 Aug 2004 09:19:09 -0400
>> >Lines: 39
>> >X-Priority: 3
>> >X-MSMail-Priority: Normal
>> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>> >Message-ID: <uXB#(E-Mail Removed)>
>> >Newsgroups: microsoft.public.dotnet.languages.vb
>> >NNTP-Posting-Host: h26.d169bd.dial.xtelegent.net 209.105.189.26
>> >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>> >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:222957
>> >X-Tomcat-NG: microsoft.public.dotnet.languages.vb
>> >
>> >Thanks. I tried it and it works great.
>> >
>> >Craig, I know you know something about the RichTextBox so I'd appreciate

>it
>> >if you'd take a minute to read my last post under Using Regular

>Expressions
>> >with a RichTextBox, 8/12/2004 8.54 AM
>> >
>> >Should I just forget it!
>> >
>> >No one seems to know anything about it.
>> >
>> >Even a hint as to where I can go to get more info would be greatly
>> >appreciated.
>> >
>> >I've been looking for some time now.
>> >
>> >Thanks again for the reply below.
>> >
>> >
>> >
>> >"Craig Vick [MSFT]" <craigv_@online.microsoft.com> wrote in message
>> >news:(E-Mail Removed)...
>> >> You can do something like
>> >>
>> >> Public Sub AddEvent(ByVal qq As Control, ByVal handler As EventHandler)
>> >> AddHandler qq.MouseMove, handler
>> >> End Sub
>> >>
>> >> You would call it like this:
>> >>
>> >> Dim eHandler As New EventHandler(AddressOf ControlMouseMove)
>> >> AddEvent(Button1, eHandler)
>> >>
>> >> Craig VB.Net Team
>> >> --------------------------------------------------------------------
>> >> This reply is provided AS IS, without warranty (express or implied).
>> >> --------------------
>> >
>> >
>> >
>> >

>>
>> Thanks & Regards
>> Santhosh Somayajulu
>> Internet Information Services Team,
>> Microsoft
>>
>>

>
>
>


Thanks & Regards
Santhosh Somayajulu
Internet Information Services Team,
Microsoft


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding event handler in C# ? Rich P Microsoft C# .NET 5 8th Mar 2009 08:18 AM
adding a event handler in MFC application for c# event Mayur Gadhave Microsoft VC .NET 2 30th Aug 2006 08:14 AM
adding a event handler in MFC application for c# event Mayur Gadhave Microsoft C# .NET 0 30th Aug 2006 07:38 AM
Adding an event handler in a sub Just Me Microsoft VB .NET 7 10th Aug 2004 01:29 AM
Adding an event handler for Outlook using VB (not VBA) Ted Byers Microsoft Outlook Program Addins 2 20th Jan 2004 03:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 AM.