When running the program, you often need to pop up some prompts to communicate with users. The focus needs to be forcibly moved to the prompt box. After the user completes the pre-set dialog, the subsequent operations can be continued.
These prompt boxes are designed to help users interact with computers more accurately and effectively. They are a considerate user assistant. A powerful assistant must be able to give clear guidance in complicated areas, give warnings in case of danger, and give feedback on issues of interest in a timely manner, in order to become a good assistant, we need to clarify the strong relationship between different choices. Since it is assistance, you cannot shake your eyes. If you want to appear in due time, it will appear too much, affecting efficiency. Instead, it will help you. Because it is just an assistant, we should try our best to use the sigh tone when providing suggestions and opinions, and we should not be too blunt when issuing warnings,
(1) News: The least powerful.
Msgbox ("operation successful! ", Vbokonly + vbinformation," prompt ")
(2) Select: Moderate intensity, which must be taken seriously.
If msgbox ("continue? ", Vbyesno + vbquestion," select ") = msgboxresult. OK then' // continue else exit sub '// otherwise exit or perform other operations. End if
(3) Warning: The most powerful, serious problem. You need to stop the current operation and change the operation.
If msgbox ("insufficient power, Please power up as soon as possible! ", Vbokonly + vbexclamation," alert ") = msgboxresult. OK then else exit sub end if
During the compilation process, it was found that some information was less clearly described. When there were too many words, it was easy to find important information and difficult for users to find the key points.
At this time, I found a way to write the most important and concise information in the first line, and write other content in detail. In this case, you only need to use the line feed ("vbcr" or "vbcrlf.
For example, msgbox ("the basic data of the system is not set. Currently, operations on the machine are not supported. "& Vbcrlf &" contact the administrator! ", Msgboxstyle. Exclamation," prompt ")
Finally, let's look at a msgbox statement.
If msgbox ("continue? ", Vbyesno + vbquestion + vbmsgboxsetforeground + vbdefaultbutton1," select ") = msgboxresult. OK then' // continue else exit sub '// otherwise exit or perform other operations. End if </span>There is no syntax error in the above program, and keywords starting with VB in the middle do not have the order requirement. It can be seen from here that the use is very simple.
The following describes some common operations:
+ Vbabort: the abort button is displayed.
+ Vbignore: the "Ignore" button is displayed.
+ Vbretry: The Pay Attention button is displayed.
Msgboxresult. Abort: click "Abort ".
Msgboxresult. Ignore: click Ignore.
Msgboxresult. Retry: click "retry ".
Msgbox prompt box