You don't know.-Don't bother me with the title of msgbox.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.