Quickly edit VB program tips

xiaoxiao2021-03-06  58

1. In the VB program, some particularly long sentences are usually encountered so that if the program is read, it is very inconvenient. Especially when calling the Windows API function, the program is generally very long. A method in VB can make the program to wrap, as long as the last character of each wrap is added to the wrap character "_" (spaces), as the API function is:

private declare function advanced document properties lib "winspool.drv" alias _ "advanceddocumentpropertiesa" (byval hwnd as long, byval hprinter as long, byval _ pdevicename as string, pdevmodeoutput as devmode, pdevmodeinput as _ devmode) as long

2. We all know that in the VC program, we can use "/ *" and "* /" to comment a program, but there are many people who have noteded a block in VB. In the VB, a sentence is implemented with single quotes "'", and the comment is added to "'" in front of each sentence, so if it is hand-made, it is very cumbersome. A special tool is provided in VB: Right-click the toolbar, then select the Edit item, so that the editing toolbar is opened, with two button functions to "Set Comment Block" and "Release Notes", So you will be a lot!

3. Sometimes we are in programming, you will set a lot of properties of the same control. At this time, if we write the control name each time, it is very repetitive and cost-effective, so we can use the following methods: with .. .end with.

Such as: private sub form_load ()

WITH FORM1

Caption = "Hello!"

.forecolor = vbbplay

Backcolor = VBRED

Fontbold = true

End with

End Sub

转载请注明原文地址:https://www.9cbs.com/read-112776.html

New Post(0)