VB6选项卡不显示在窗体上

时间:2017-06-28 19:45:27

标签: vb.net vb6 vb6-migration

我最近下载了VB6来打开一个.VBP文件,我正在转换为VB2010。我的目标是在VB6上运行程序,这样我就可以逐行遍历代码,以便调试我在VB2010中从头开始编写的程序。

该程序运行虚拟机,具有如下所示的星形形式:

Form on virtual machine

但是,当我在VB6上查看启动表单时,我看到了: Form on VB6

如您所见,缺少标签页。当我运行代码时,调试器在涉及标签页的第一行中断(FrontWeights等是几个标签页的所有名称 (GRIDS的名称,而不是标签页) < / strong>,调试器中断“FrontWeights.ColWidth(1)= 4280 + 1000”):

Private Sub Form_Load()
  Screen.MousePointer = 11

  Width = 10680
  Height = 6816
  FrontWeights.ColWidth(1) = 4280 + 1000
  FrontWeights.ColWidth(2) = 1109
  FrontWeights.ColWidth(3) = 1109
  FrontWeights.ColWidth(4) = 1109
  For I = 1 To 100
    FrontWeights.AddItem Str$(I), I
  Next I
  FrontWeights.Row = 0
  FrontWeights.Col = 1
  FrontWeights.Text = "Description"
  FrontWeights.Col = 2
  FrontWeights.Text = "Quantity"
  FrontWeights.Col = 3
  FrontWeights.Text = "Weight (lbs)"
  FrontWeights.Col = 4
  FrontWeights.Text = "Offset (in)"

  BogieWeights.ColWidth(1) = 4280 + 1000
  BogieWeights.ColWidth(2) = 1109
  BogieWeights.ColWidth(3) = 1109
  BogieWeights.ColWidth(4) = 1109
  For I = 1 To 100
    BogieWeights.AddItem Str$(I), I
  Next I
  BogieWeights.Row = 0
  BogieWeights.Col = 1
  BogieWeights.Text = "Description"
  BogieWeights.Col = 2
  BogieWeights.Text = "Quantity"
  BogieWeights.Col = 3
  BogieWeights.Text = "Weight (lbs)"
  BogieWeights.Col = 4
  BogieWeights.Text = "Offset (in)"

  CenterWeights.ColWidth(1) = 4280 + 1000
  CenterWeights.ColWidth(2) = 1109
  CenterWeights.ColWidth(3) = 1109
  CenterWeights.ColWidth(4) = 1109
  For I = 1 To 100
    CenterWeights.AddItem Str$(I), I
  Next I
  CenterWeights.Row = 0
  CenterWeights.Col = 1
  CenterWeights.Text = "Description"
  CenterWeights.Col = 2
  CenterWeights.Text = "Quantity"
  CenterWeights.Col = 3
  CenterWeights.Text = "Weight (lbs)"
  CenterWeights.Col = 4
  CenterWeights.Text = "Offset (in)"

  InternalPipingGrid.ColWidth(1) = 3005
  InternalPipingGrid.ColWidth(2) = 795
  InternalPipingGrid.ColWidth(3) = 795
  InternalPipingGrid.ColWidth(4) = 795
  InternalPipingGrid.ColWidth(5) = 795
  InternalPipingGrid.ColWidth(6) = 795
  InternalPipingGrid.ColWidth(7) = 795
  InternalPipingGrid.ColWidth(8) = 795
  For I = 1 To 100
    InternalPipingGrid.AddItem Str$(I), I
  Next I
  InternalPipingGrid.Row = 0
  InternalPipingGrid.Col = 1
  InternalPipingGrid.Text = "Description"
  InternalPipingGrid.Col = 2
  InternalPipingGrid.Text = "Lbs/Ft"
  InternalPipingGrid.Col = 3
  InternalPipingGrid.Text = "Gal/Ft"
  InternalPipingGrid.Col = 4
  InternalPipingGrid.Text = "Passes"
  InternalPipingGrid.Col = 5
  InternalPipingGrid.Text = "X Front"
  InternalPipingGrid.Col = 6
  InternalPipingGrid.Text = "Y Front"
  InternalPipingGrid.Col = 7
  InternalPipingGrid.Text = "X Rear"
  InternalPipingGrid.Col = 8
  InternalPipingGrid.Text = "Y Rear"

  KingPinWeights.ColWidth(1) = 4280 + 1000
  KingPinWeights.ColWidth(2) = 1109
  KingPinWeights.ColWidth(3) = 1109
  KingPinWeights.ColWidth(4) = 1109
  For I = 1 To 100
    KingPinWeights.AddItem Str$(I), I
  Next I
  KingPinWeights.Row = 0
  KingPinWeights.Col = 1
  KingPinWeights.Text = "Description"
  KingPinWeights.Col = 2
  KingPinWeights.Text = "Quantity"
  KingPinWeights.Col = 3
  KingPinWeights.Text = "Weight (lbs)"
  KingPinWeights.Col = 4
  KingPinWeights.Text = "Offset (in)"

  LandingLegWeights.ColWidth(1) = 4280 + 1000
  LandingLegWeights.ColWidth(2) = 1109
  LandingLegWeights.ColWidth(3) = 1109
  LandingLegWeights.ColWidth(4) = 1109
  For I = 1 To 100
    LandingLegWeights.AddItem Str$(I), I
  Next I
  LandingLegWeights.Row = 0
  LandingLegWeights.Col = 1
  LandingLegWeights.Text = "Description"
  LandingLegWeights.Col = 2
  LandingLegWeights.Text = "Quantity"
  LandingLegWeights.Col = 3
  LandingLegWeights.Text = "Weight (lbs)"
  LandingLegWeights.Col = 4
  LandingLegWeights.Text = "Offset (in)"

  RearWeights.ColWidth(1) = 4280 + 1000
  RearWeights.ColWidth(2) = 1109
  RearWeights.ColWidth(3) = 1109
  RearWeights.ColWidth(4) = 1109
  For I = 1 To 100
    RearWeights.AddItem Str$(I), I
  Next I
  RearWeights.Row = 0
  RearWeights.Col = 1
  RearWeights.Text = "Description"
  RearWeights.Col = 2
  RearWeights.Text = "Quantity"
  RearWeights.Col = 3
  RearWeights.Text = "Weight (lbs)"
  RearWeights.Col = 4
  RearWeights.Text = "Offset (in)"

  Screen.MousePointer = 0
End Sub

有关如何解决此问题的任何帮助?仅供参考 - 这是一个工作项目,所以我会犹豫是否要共享/上传文件。

编辑:项目文件的文本:

Type=Exe
Module=MODULE11; TransWgt.Bas
Form=TankSize.frm
Form=Properti.frm
Form=Bulkhead.frm
Form=PrintOut.frm
Form=Drawing.frm
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX
Object={00028C01-0000-0000-0000-000000000046}#1.0#0; DBGRID32.OCX
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#Standard OLE Types
Reference=*\G{00025E01-0000-0000-C000-000000000046}#4.0#0#C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL#Microsoft DAO 3.0 Object Library
Form=InputData.Frm
Startup="InputDataForm"
HelpFile=""
Title="Transport Weight Analysis"
ExeName32="TransWgt.Exe"
Command32=""
Name="TransportWeightAnalysis"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionComments="This is a pre-release version of this program."
VersionCompanyName="E.D. Etnyre & Co."
VersionFileDescription="Program for calculating weight distributions of any transport."
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

编辑2:将VM表单更改为整个屏幕显示的内容(即菜单)

编辑3: 有一个.CLS文件,VB6最初无法加载。我手动添加没有。现在,当我运行时,我的错误显示“编译器错误:外部程序无效”

1 个答案:

答案 0 :(得分:1)

除了你之外没有人能说出发生了什么,但是 - 只是猜测 - TABCTL32.OCX中包含的对SSTabs的引用已被删除(或者被引用替换为mscomctl.ocx,因为TabStrip ......?)并且项目已保存。

至少,我可以告诉你为什么你没有看到表格上的任何其他控件,而不是第一个标签:

下面你会看到一个带有三个标签的表格,每个标签内有一个控件:

enter image description here

SSTabs的工作方式是将控件移到表单外部的左侧以隐藏它:

      Text1.Left = 480           Text2.Left = -74520           Text3.Left = -74520

使用记事本打开.frm文件,控件应该在那里,但你无法在IDE中看到它。

最后,根据您的项目的重要性,我相信您有两个选择:

  • .frm SSTabs中手动恢复,然后在IDE中将控件放在另一个容器上
  • 通过将左侧坐标移动75000
  • ,在.frm文件中手动更改控件位置

我不清楚你确切安装了哪个VB6版本,为了方便起见,我在下面添加了一个完整的.frm.文件,您可以在其中查看存储的SSTabs结构。添加您需要的标签。

VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3615
   LinkTopic       =   "Form1"
   ScaleHeight     =   2835
   ScaleWidth      =   3615
   StartUpPosition =   3  'Windows Default
   Begin TabDlg.SSTab SSTab1 
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3285
      _ExtentX        =   5794
      _ExtentY        =   4471
      _Version        =   393216
      TabHeight       =   520
      TabCaption(0)   =   "Tab 0"
      TabPicture(0)   =   "FormTabs.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Text1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).ControlCount=   1
      TabCaption(1)   =   "Tab 1"
      TabPicture(1)   =   "FormTabs.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Text2"
      Tab(1).Control(0).Enabled=   0   'False
      Tab(1).ControlCount=   1
      TabCaption(2)   =   "Tab 2"
      TabPicture(2)   =   "FormTabs.frx":0038
      Tab(2).ControlEnabled=   0   'False
      Tab(2).Control(0)=   "Text3"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).ControlCount=   1
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   -74520
         TabIndex        =   3
         Text            =   "Text3"
         Top             =   1680
         Width           =   2295
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   -74520
         TabIndex        =   2
         Text            =   "Text2"
         Top             =   1080
         Width           =   2295
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   480
         TabIndex        =   1
         Text            =   "Text1"
         Top             =   720
         Width           =   2295
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

End Sub

同样的引用应添加到.vbp文件中,位于最顶层,靠近其他文件:

Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX