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

该程序在虚拟机上运行,​​具有如下形式的starup形式:

vb.net - VB6选项卡未显示在窗体上-LMLPHP

但是,当我在VB6上查看启动表单时,看到以下内容:
vb.net - VB6选项卡未显示在窗体上-LMLPHP

如您所见,选项卡页面丢失了。当我运行代码时,调试器在涉及选项卡页面的第一行中断(FrontWeights等都是少数几个选项卡页面的名称(GRIDS的名称,而不是选项卡页面),并且调试器在“ 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最初无法以某种方式加载。我手动添加没有。现在,当我运行时,我的错误提示为“编译器错误:外部程序无效”

最佳答案

除了您没有其他人可以说出发生了什么,但是-只是猜测-TABCTL32.OCX中包含的对SSTab的引用已被删除(或由于TabStrip而被对mscomctl.ocx的引用所取代...?)和项目已保存。

至少,我可以告诉您为什么除了第一个Tab之外,您看不到窗体上的任何其他控件:

在下面,您将看到一个带有三个选项卡的表单,每个选项卡都在其中:

vb.net - VB6选项卡未显示在窗体上-LMLPHP

SSTabs的工作方式是将控件移到窗体外部的左侧以将其隐藏:

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


用记事本打开.frm文件,控件应在其中,但只是在IDE中看不到它。

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


手动在.frm SSTab中还原,然后在IDE中,将控件放置在其他容器上
手动更改.frm文件中的控件位置,方法是将左坐标移动75000


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

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

关于vb.net - VB6选项卡未显示在窗体上,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44811316/

10-16 15:42