In VB6, msgbox is annoying. When I organize the code, I usually check whether the title of each msgbox is correct, because different programmers have different habits, some people are willing to omit it. Is there any way to unify the title in msgbox?
A: Of course there is a solution. One is to set the project name in the VB6 project, and all msgboxes omit the title, so that the display of msgbox is unified, however, this is too uncomfortable. The control displayed in the title is too inflexible. If some users use a custom title, there is no way to do this.
Another way is to use a constant and then let everyone reference this constant in the title. This method seems to solve the problem, but what if someone else does not use this constant? It's not easy.
Is there any good way? You can solve this problem in VB6.
Define a msgbox function in the module, which will overwrite the msgbox provided by the system, and solve the problem, which is very simple.
The Code is as follows: 'encapsulate msgbox to ensure prompt consistency.
Public Function msgbox (prompt as string, optional button as vbmsgboxstyle, optional title as string = "") as vbmsgboxresult
Msgbox = VBA. msgbox (prompt, button, "prompt ")
End Function
In this way, the msgbox takes over the msgbox of the system. When this method can cover many system functions, it can unify the usage of all programmers. If there are better programming constraints, if you don't have it, you don't have to worry about it. You just need to write it and use the unified functions.
Well, I need to use this function to process the punctuation marks in prompt. I hope that all prompt can be in half-width English, but there are still some Chinese Punctuation Marks, with this, I can modify these headaches.