Click here to Skip to main content
15,902,112 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 12:20
treddie1-Jul-13 12:20 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 19:29
treddie1-Jul-13 19:29 
GeneralRe: How to get address of a function or method Pin
Richard Deeming2-Jul-13 1:25
mveRichard Deeming2-Jul-13 1:25 
GeneralRe: How to get address of a function or method Pin
treddie2-Jul-13 9:41
treddie2-Jul-13 9:41 
QuestionHow to express this in a Regex? Pin
Sonhospa28-Jun-13 0:50
Sonhospa28-Jun-13 0:50 
AnswerRe: How to express this in a Regex? Pin
thanh_bkhn28-Jun-13 2:50
professionalthanh_bkhn28-Jun-13 2:50 
News[RESOLVED] Re: How to express this in a Regex? Pin
Sonhospa28-Jun-13 2:59
Sonhospa28-Jun-13 2:59 
QuestionMS at it again Pin
treddie26-Jun-13 19:57
treddie26-Jun-13 19:57 
Hi all.

Sorry for the frustration here, but I always dread going to MS for any kind of help anymore, regarding what this-or-that does. For years now, they are extremely spotty in their ability to describe something simply and unambiguously. Below is a perfect example; a paragraph which talks in circles:

"The WithEvents statement and the Handles clause provide a declarative way of specifying event handlers. An event raised by an object declared with the WithEvents keyword can be handled by any procedure with a Handles statement for that event, as shown in the following example:"

Sounds like lawyer talk, so whenever I run into lawyer talk, I try to reword it into an explicit example. So here goes.

"A button's mouse click event raised by a button, declared with the WithEvents keyword can be handled by any procedure with a Handles statement for the button mouse click event..."

That's like saying "A box with a lid, has a lid on it."

It seems to be saying that if I use the WithEvents keyword, I can attach, for example, the statement, "Handles Button3.Click" on to ANY procedure and the procedure will respond to the Button3.Click event. Well...Duh! I can do that withOUT the WithEvents keyword! So what is the difference?

Or did they MEAN to say,

"A user can declare a custom event with the WithEvents keyword. Then, any procedure can use that event just like any other event, by attaching it at the end of a procedure's declaration, with the "Handles" clause."

If so, why use the keyword "WithEvents at all? Why not just,
VB
Public Event MyCustomEvent
'Description of event goes here.
End Event


OR, are they trying to say this,

'Using the WithEvents keyword, a class is declared that can contain multiple events, any of which can be used at the end of a procedure's declaration with the "Handles" clause. For example,
VB
'Declare a new collection of events:
Dim WithEvents MyEventsCollection As New EventsCollection1

'Create the class, declared above:
Class EventsCollection1
  Public Event My1stEvent()
  Public Event My2ndEvent()
End Class


'Then, any procedure can have a Handles clause at the end of it, which assigns any of the events in the collection,
VB
Private Sub ThisProcedure() Handles EventsCollection1.My1stEvent
'...Do stuff.
End Sub


If THAT is what they mean, why put all of those events in a collection (a Class), instead of just calling them all out individually? That is a lot less work:
VB
Private Sub ThisPrcoedure() Handles My1stEvent, My2ndEvent
'...Do stuff.
End Sub


Please help me straighten this out, since I am obviously missing something really important about WithEvents that MS can't explain without ambiguity.
AnswerRe: MS at it again Pin
Eddy Vluggen27-Jun-13 0:23
professionalEddy Vluggen27-Jun-13 0:23 
GeneralRe: MS at it again Pin
treddie28-Jun-13 11:20
treddie28-Jun-13 11:20 
GeneralRe: MS at it again Pin
Eddy Vluggen3-Jul-13 6:56
professionalEddy Vluggen3-Jul-13 6:56 
AnswerRe: MS at it again Pin
Dave Kreskowiak27-Jun-13 1:52
mveDave Kreskowiak27-Jun-13 1:52 
GeneralRe: MS at it again Pin
treddie28-Jun-13 11:21
treddie28-Jun-13 11:21 
QuestionSize of a Structure Pin
Smith00526-Jun-13 18:51
Smith00526-Jun-13 18:51 
AnswerRe: Size of a Structure Pin
Mycroft Holmes26-Jun-13 19:18
professionalMycroft Holmes26-Jun-13 19:18 
GeneralRe: Size of a Structure Pin
Smith00526-Jun-13 19:47
Smith00526-Jun-13 19:47 
GeneralRe: Size of a Structure Pin
Richard Deeming27-Jun-13 3:09
mveRichard Deeming27-Jun-13 3:09 
AnswerRe: Size of a Structure Pin
Dave Kreskowiak27-Jun-13 1:45
mveDave Kreskowiak27-Jun-13 1:45 
QuestionCannot Drag and drop reportviewer control in visual studio 2010 Pin
waner michaud26-Jun-13 9:25
waner michaud26-Jun-13 9:25 
QuestionRe: Cannot Drag and drop reportviewer control in visual studio 2010 Pin
TnTinMn26-Jun-13 15:44
TnTinMn26-Jun-13 15:44 
AnswerRe: Cannot Drag and drop reportviewer control in visual studio 2010 Pin
waner michaud27-Jun-13 5:06
waner michaud27-Jun-13 5:06 
GeneralRe: Cannot Drag and drop reportviewer control in visual studio 2010 Pin
TnTinMn27-Jun-13 10:33
TnTinMn27-Jun-13 10:33 
GeneralRe: Cannot Drag and drop reportviewer control in visual studio 2010 Pin
waner michaud28-Jun-13 2:50
waner michaud28-Jun-13 2:50 
GeneralRe: Cannot Drag and drop reportviewer control in visual studio 2010 Pin
waner michaud1-Jul-13 6:11
waner michaud1-Jul-13 6:11 
QuestionFile Downloader Help Pin
Bradley Sweeten26-Jun-13 4:04
Bradley Sweeten26-Jun-13 4:04 

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.