问题
I'm a long-time Delphi programmer that's been handed an older VB app to make compatible with Win7. (I haven't touched any species of basic since the DOS days, so I'm new to VB/VS 2010 - I've taken the beginner DevU trainings, and have a handle on the basics of VB syntax compared to Delphi, but don't have much clue on the vagaries of how VS and .NET put that code together into an app.) The code has worked fine for years under WinXP, but it does some things (registry writes, cfg files stored in the EXE folder, etc.) that Win7 balks at.
The app references a set of assemblies that provide services to control certain industrial equipment. The DLLs for these are in Windows\System32 so they should be found; I tried running regsvr32 on them to see if they needed to be registered, but they're missing the server entry points. The objects for these are instantiated in the InitializeComponent() sub of frmMain.Designer.vb:
Me.AxDiamondctrl1 = New AxDIAMONDCTRLLib.AxDiamondctrl()
Me.AxDiamondsetupctrl1 = New AxDIAMONDSETUPCTRLLib.AxDiamondsetupctrl()
then, in the Me.Startup handler in ApplicationEvents.vb, a couple of the assembly methods get called to initialize things:
frmMain.AxDiamondctrl1.InitLowerLayer()
frmMain.AxDiamondsetupctrl1.InitCore()
Problem: The instantiation calls are in the InitializeComponent() handler along with all the calls to instantiate the numerous visual components on the main form. However, at startup, the main form comes up blank, with none of the visual components (menu, toolbar, buttons, etc.) I'm unable to trace this in the debugger, and unable to view the form in the form designer for some unknown reason, but it appears that the InitializeComponent() handler either doesn't get called or exceptions out, and since the code works under WinXP, I'm assuming it's the latter. And because the control instances in the form object are nil, the references in the Startup handler toss exceptions.
Why would these not be loading properly?
Thanks! Steve
来源:https://stackoverflow.com/questions/47684671/vb-2010-assembly-doesnt-load-at-startup