Click here to Skip to main content
15,926,062 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionEnter key pressed event Pin
faisalali_7813-May-10 19:56
faisalali_7813-May-10 19:56 
AnswerRe: Enter key pressed event Pin
Rajesh Anuhya13-May-10 20:04
professionalRajesh Anuhya13-May-10 20:04 
AnswerRe: Enter key pressed event Pin
Wayne Gaylard13-May-10 20:15
professionalWayne Gaylard13-May-10 20:15 
Questioncontext menu Pin
phowarso13-May-10 19:53
phowarso13-May-10 19:53 
AnswerRe: context menu Pin
DaveAuld13-May-10 20:28
professionalDaveAuld13-May-10 20:28 
Questionfor text box control in VB.net Pin
faisalali_7813-May-10 19:37
faisalali_7813-May-10 19:37 
AnswerRe: for text box control in VB.net Pin
Rajesh Anuhya13-May-10 19:51
professionalRajesh Anuhya13-May-10 19:51 
QuestionMessageBox.Show not raising HelpRequested event Pin
Trevortni13-May-10 8:42
Trevortni13-May-10 8:42 
I have a form that is showing a MessageBox using MessageBox.Show, and trying to receive events from the Help button on the MessageBox so I can execute my own code. The Microsoft documentation shows how to do this; however, using what is suggested does not work. Here's a shortened version of my code:

Private Function MethodName() As Boolean

  AddHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested
  Select Case MessageBox.Show("Text", "Title", MessageButtons.YesNoCancel, _
            MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, True)
    Case MsgBoxResult.Yes
      ' Do stuff
    Case MsgBoxResult.No
      ' Do stuff
    Case MsgBoxResult.Cancel
      RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested
      Return False
  End Select
  RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested

End Function
'
'
Private Sub MsgBoxHelpRequested(ByVal sender As Object, _
            ByVal hlpevent As System.Windows.Forms.HelpEventArgs)
  ' Breakpoint that never gets hit
  ' More code
End Sub


I posted this question yesterday on stackoverflow[^], where we get into quite a spirited discussion, with a bunch of suggestions that ultimately never seemed to pan out, if you want to see what I've already tried.

Currently I'm working on seeing if there's any way to determine if the event was even raised in the first place - either by trying to manually raise the event and see if my code gets called, or seeing if there's any way to break on an event.

Does anybody have any suggestions?

Oh, and by the way, Chris Maunder: CodeProject is much better designed than StackOverflow. Reading stackoverflow is a pain on the eyes, trying to comment is a pain in the neck - coming back home here is such a relief. While the people over there are just as nice as here, I wish I had thought to check here yesterday.
AnswerRe: MessageBox.Show not raising HelpRequested event Pin
DaveAuld13-May-10 8:56
professionalDaveAuld13-May-10 8:56 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
Trevortni13-May-10 9:14
Trevortni13-May-10 9:14 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
DaveAuld13-May-10 9:21
professionalDaveAuld13-May-10 9:21 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
Trevortni13-May-10 9:48
Trevortni13-May-10 9:48 
AnswerRe: MessageBox.Show not raising HelpRequested event Pin
William Winner13-May-10 9:18
William Winner13-May-10 9:18 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
Trevortni13-May-10 9:46
Trevortni13-May-10 9:46 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
DaveAuld13-May-10 9:49
professionalDaveAuld13-May-10 9:49 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
DaveAuld13-May-10 9:47
professionalDaveAuld13-May-10 9:47 
QuestionRe: MessageBox.Show not raising HelpRequested event [modified] Pin
Trevortni13-May-10 10:39
Trevortni13-May-10 10:39 
AnswerRe: MessageBox.Show not raising HelpRequested event Pin
Trevortni13-May-10 12:04
Trevortni13-May-10 12:04 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
DaveAuld13-May-10 20:33
professionalDaveAuld13-May-10 20:33 
GeneralRe: MessageBox.Show not raising HelpRequested event Pin
Henry Minute14-May-10 2:02
Henry Minute14-May-10 2:02 
QuestionCREATE DATABASE parameter for FROM master..sysdatabases Pin
luccingolo13-May-10 8:05
luccingolo13-May-10 8:05 
AnswerRepost Pin
Luc Pattyn13-May-10 8:38
sitebuilderLuc Pattyn13-May-10 8:38 
GeneralRe: Repost Pin
luccingolo14-May-10 5:16
luccingolo14-May-10 5:16 
GeneralRe: Repost Pin
Luc Pattyn14-May-10 5:43
sitebuilderLuc Pattyn14-May-10 5:43 
GeneralRe: Repost Pin
luccingolo14-May-10 6:21
luccingolo14-May-10 6:21 

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.