VB6默默地从表单中删除大量的控制数据 [英] VB6 silently deleting huge chunks of control data from forms

查看:199
本文介绍了VB6默默地从表单中删除大量的控制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目在SSTab(4个选项卡)中可能有130个控件(所有标签,文本框等的总数)。项目加载正常,运行正常,我在任何时候都没有看到单个错误或警告,但是当我保存带有SStab的表单时,SStab数据不会保存(它已完全消失)。通常,.frm文件的相关部分如下所示:

My project has maybe 130 controls (total of all labels, textboxes, etc.) in an SSTab (4 tabs). The project loads fine, it runs fine, I don't see a single error or warning at any point, but when I save the form with the SStab on it, the SStab data isn't saved (it is completely gone). Normally the relevant portion of the .frm file looks like this:

   Begin TabDlg.SSTab SSTab1 
     Height          =   8895
     [1550 more lines of code for all the controls]
     Width           =   540
   End
   Begin VB.Menu FileMenu

但最近它是被裁剪为:

   Begin TabDlg.SSTab SSTab1 
   Begin VB.Menu FileMenu

这非常令人沮丧!在我的VB IDE中,框架,sstab和所有控件都在那里,可编辑,运行/编译正常,任何时候都没有错误消息,但是当你保存文件时,1550行珍贵的sstab数据就会消失 - 再次,没有警告或错误消息。因此,如果退出并重新启动IDE,则会出现表单加载错误,因为现在缺少60%的代码。日志文件指向它找到的第一个错误(在这种情况下是没有结束的Begin TabDlg) - 其中没有其他信息。 (日志文件是在删除并保存代码后生成的,所以它没有用处是有意义的。)

This is very frustrating! In my VB IDE, the frame, sstab, and all the controls are there, editable, running/compiling fine, no error messages at any point, but when you save the file, 1550 lines of precious sstab data just disappears - again, with no warning or error messages. So if you exit and restart the IDE, you get a form load error because 60% of the code is now missing. The log file points to the first error it finds (in this case a Begin TabDlg with no End) - there's no other info in it. (The log file was generated after the code was deleted and saved, so it makes sense that it wouldn't be helpful.)

当我第一次发布这个问题时,我认为它与控件的数量有关,因为它在我添加一个控件之后出现,并且在我的前几次测试中,当该控件(或其他控件)被删除时似乎消失了。现在我似乎无法在任何情况下保存该表格,即使我删除了许多控件(将控件数量远远低于上次稳定时的控件数量)。

When I first posted this question, I thought it had to do with the number of controls, because it appeared after I added a control, and in my first few tests, seemed to disappear when that control (or other controls) was deleted. Now I can't seem to get that form to save under any circumstances, even when I delete many controls (bringing the number of controls far below where it was when it was last stable).

我还尝试删除SStab并将所有控件移动到4个不同的帧。我在IDE中成功地做到了这一点,但是当我保存时,大量数据(从滑块控件开始)丢失了。所以我不知道发生了什么。

I also tried deleting the SStab and moving all the controls to 4 different frames. I successfully did that in the IDE, but when I saved, a huge chunk of the data (starting with a slider control) was missing. So I have no fraking idea what is going on.

这个问题可以在两台不同的PC上重现,所以它似乎不是一个硬件/损坏的软件VB安装问题。

The problem is reproducible on two different PCs, so it doesn't appear to be a hardware/corrupt software VB install issue.

还有其他人遇到过这样的事吗?

Has anyone else run into something like this?

推荐答案

为每个选项卡创建一个UserControl。这使编辑更容易。它还允许您很好地模块化代码,因此每个选项卡都存在于自己的文件中,如果您愿意,它还允许您在其他位置重复使用选项卡。

Create a UserControl for each tab. That makes editing MUCH easier. It also allows you to nicely modularize the code, so each tab lives in its own file, and it'll allow you to reuse tabs elsewhere if you want.

这篇关于VB6默默地从表单中删除大量的控制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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