Home > Software engineering >  Messageboxbuttons. YesNo Click yes events can trigger a Click event
Messageboxbuttons. YesNo Click yes events can trigger a Click event

Time:10-04

Messageboxbuttons. YesNo can Click yes event triggers the Click event, similar messageboxbuttons. Yes. Click +=new EventHandler (question_Click); Should I write the code, how to write, please god help!!!!!!

CodePudding user response:

 Private Sub Command1_Click () 
If MsgBox ("?" , vbQuestion + vbYesNo)=vbYes Then
The Debug. Print "chose Yes
"The Else
The Debug. Print "chose No
"End the If
End Sub

CodePudding user response:

Can't trigger you want unless you use a form from the definition of a "dialog",

Want to be in your call MsgBox or MessageBox. Show of code determine its return value, such as upstairs in the VB 6, the following c #
 
If (MessageBox. Show (" choose?" , "", MessageBoxButtons YesNo, MessageBoxIcon. Question)==DialogResult. Yes)
{
MessageBox (" click on the button "is" ");
}
The else
{
MessageBox (" click on the button "no" ");
}

Indeed you expect event processing, have been encapsulated in the corresponding function, provided no external interface,

CodePudding user response:

That is the message box system, like a function that provides you with a return value, you can according to the return value judgment points which button, and then call call question_Click a button click event of the process

CodePudding user response:

This trigger is system level event!

CodePudding user response:

If MessageBox. Show (... )=DialogResult. Yes Then
Button2. PerformClick ()
End If

CodePudding user response:

In fact you can customize a window class, the window class used to instantiate the message window, this type of implementation to support what you need

CodePudding user response:

You don't call the function directly?
  • Related