Suppose you have a form that you use frequently. For example, there is a calendar control in the upper left corner of the form. To make it easier to create this kind of form, you can create an instance according to your needs, place the calendar control, set its properties, etc.
Then, save this form in the template directory, such as: C:Program FilesMicrosoft Visual StudioVb98TemplateForms.
Now, select "Add Form" from the Project menu, and an option will appear for the form you just created. When this type of form is added, the originally set properties will also exist.
About .FRX files
What is a FRX file? How to edit them? Can it function without them?
Visual Basic saves binary information in the FRX file. For example, if you set the graphic properties of a form at design time, Visual Basic saves the graphic in the FRX file. If the FRX file is deleted at this time, an error will occur when the project file is opened again, and all relevant information will be lost.
If you replace a form's graphic properties at design time, Visual Basic will make the corresponding changes in the FRX file. However, editing FRX files individually is not recommended because there is really no way.
Nothing actually happens without these FRX files, unless there is a need to reproduce binary information at design time, such as graphics files. You can save graphics and other information in a resource file and call it at runtime, or you can store the information separately and call it at runtime. This method won't bring you any more benefits, because these separate files must exist when the program is running. On the contrary, if you let Visual Basic save this information to the FRX file, when compiled and run, this information will be included in a separate EXE file.
Determine whether the form has been loadedYou can use a form collection to determine whether a form with a certain name has been loaded. The method is: loop through the form collection and compare whether each item matches the target name:
Note: Return a form by name if it is loaded.
Private Function FindForm(ByVal form_name As String) As Form
Dim i As Integer
Note: Assume we will not find it.
Set FindForm = Nothing
Note: Search the loaded forms.
For i = 0 To Forms.Count - 1
If Forms(i).Name = form_name Then
Comment: We found it. Return this form.
Set FindForm = Forms(i)
Exit For
End If
Next i
End Function
Why doesn't the form appear in the taskbar?When debugging and running in programming, sometimes it is found that the form does not appear in the taskbar. What is the reason? Possible reasons include the following:
1. ShowInTaskBar is set to False
2. The form is an MDI subform
3. The BorderStyle of the form is a fixed-size dialog box
4. The BorderStyle of the form is a fixed-size ToolWindow.
5. The BorderStyle of the form is a variable-sized ToolWindow.