Visual Basic Skills

Source: Internet
Author: User

Digest

Back to homepage ◎

 

Visual Basic Skills

1. Prevent the program from being repeatedly run. If you do not want your VB Application to be repeatedly run by others by double-clicking the icon multiple times, this may cause insufficient memory or other accidents, you can add the following lines in the program:

Private sub form _ load

If appprevinstance then

The msgbox program is running. Check whether the window is minimized. ″

End if

End sub

2. The ucase function is used to ensure that file operations are correct on the Win32 platform. The file name is generally lowercase letters, but sometimes uppercase occurs on the Win95 platform. To ensure that programs related to file operations developed with vb3 on the Win32 platform can work normally on the Win95 platform, you can use the ucase function to convert the file name to uppercase or lowercase. For example, if you use vb3 on the Win32 platform to develop a media browser, you can use the following sections to enable automatic playback, whether the file suffix is uppercase "Avi", "WAV", "mid", or lowercase "Avi", "WAV", "mid", or case-insensitive:

Sub file1_click ()

Mmcontrol1filename = file1path & "/" & file1filename

T = ucase (right (file1filename, 3 ))

If t = "Avi" or T = "WAV" or T = "mid" the N

Mmcontrol1command = "close ″

Mmcontrol1command = "play ″

End if

End sub

3 In vb5, the length of Chinese characters is 1 rather than 2. In vb3, the length of each Chinese character is 2, while in vb4 and vb5, the length of each Chinese character is 1. Special attention should be paid when intercepting substrings of Chinese character strings. This change makes it easier to design the sorting, retrieval, and filtering procedures of Chinese characters. In addition, in vb5, the ASCII code of Chinese characters is smaller than 0, while in vb3 or C ++, the ASCII code of Chinese characters is greater than zero.

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.