如何从多个VB6 .frm文件中删除所有代码并保留表单设计? [英] How to remove all code from multiple VB6 .frm files and leave form design?
问题描述
我有一个大型的VB6应用程序,其中包含许多.frm
文件.我想基本上从所有表单中删除"代码,然后离开GUI设计.
I have a large VB6 app with many .frm
files. I want to basically 'gut' the code from all the forms and just leave the GUI design.
快速执行此任务的最佳方法是什么?
What would be the best way to perform this task quickly?
推荐答案
如果您确实有足够的表单,则不能只打开每个表单并按 Ctrl + A , Del , Ctrl + S 然后,您始终可以编写一个快速的VB程序来执行此操作. Visual Basic将显示表单所需的信息放在文件的开头,后跟代码.将每个.frm文件复制到一个备份中,打开它,然后将所有内容(直到最后 Attribute ... 行)写入具有原始文件名的新文件.很脏,但是只需要大约15-20分钟即可写完,并在出现错误时为您提供备份.
If you really have enough forms that you can't just open each form and Ctrl + A, Del, Ctrl + S Then you can always write a quick VB program to do it. Visual Basic puts the information needed to display the form at the beginning of the file followed by the code. Copy each .frm file to a backup, open it and write everything up to the last Attribute ... line to a new file with the original file name. Pretty dirty, but should only take about 15-20 minutes to write and leaves you a backup in case of error.
示例.frm内容
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1800
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 360
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text1.Text = "Hello World"
End Sub
Private Sub Form_Load()
Text1.BackColor = vbBlue
End Sub
这篇关于如何从多个VB6 .frm文件中删除所有代码并保留表单设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!