如何从多个 VB6 .frm 文件中删除所有代码并离开表单设计? [英] How to remove all code from multiple VB6 .frm files and leave form design?

查看:12
本文介绍了如何从多个 VB6 .frm 文件中删除所有代码并离开表单设计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多 .frm 文件的大型 VB6 应用程序.我想基本上从所有表单中删除"代码,然后离开 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆