How to set a message box which has buttons like "ok" and "cancel"? Also can we name our own names for the buttons? And can we write source codes for those buttons, like
ok.click, form1.show() and if cancel.click form5.show()
msgbox()
You could use MessageBoxButtons enum to specify different kinds of buttons on messagebox and use DialogResult after the button is clicked to specify different actions for each type of messagebox button. Or create your own MessageBox
Try this:
MessageBox.Show("put your text here", "here the title of you message", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand)
after the second comma [,] you can put the type of buttons and at the last you can put the icon you think it will best suit your message box
regards
This should work:
If (MsgBox("Your Text", MsgBoxStyle.OkCancel, "MessageBox Title") = MsgBoxResult.Ok) Then
Form1.Show()
Else
form5.show()
End If
This is a simple message box:
If MessageBox.Show("some msg", "caption", MessageBoxButtons.OKCancel) = DialogResult.Cancel Then
' you cancel it, so i will show another message box
EndIf
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.