如何从多个VB6 .frm文件中删除所有代码并保留表单设计?

时间:2011-11-21 03:08:51

标签: vb6 file-processing

我有一个包含许多.frm个文件的大型VB6应用程序。我想基本上“消除”所有表格中的代码,然后离开GUI设计。

快速执行此任务的最佳方式是什么?

2 个答案:

答案 0 :(得分:2)

如果您确实有足够的表单,则无法打开每个表单并 Ctrl + A Del Ctrl + S 然后您可以随时编写一个快速VB程序来执行此操作。 Visual Basic将显示表单所需的信息放在文件的开头,然后是代码。将每个.frm文件复制到备份,打开它并将所有内容写到最后的属性... 行,并将其写入具有原始文件名的新文件。相当脏,但是只需要大约15-20分钟的时间来编写,并在发生错误时留给您备份。

示例.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 

答案 1 :(得分:0)

猜猜这是一个老问题,但如果您仍然对重构某些VB6项目感兴趣,请查看http://zoomicon.com/tranxform/上的VBFormDesign过滤工具