01-06-2009 01:07 PM
I made a simple dummy program in VB6 that uses a CWDSP control and a CWGraph control. I then opened the project in VB2008 and allowed the Upgrade Wizzard to convert my project, which it did - but with warning messages about late binding.
This codes runs ok.
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
Dim z As Object
'UPGRADE_WARNING: Couldn't resolve default property of object CWDSP1.GaussNoise(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object z. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
z = (CWDSP1.GaussNoise(500, 1, 17))
CWGraph1.PlotY(z)
End Sub
Howver, if I change the code to implement early binding - I get an exception error on the call to generate the noise waveform.
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
Dim z As Object
Dim DSP As CWAnalysisControlsLib.CWDSP DSP = New CWAnalysisControlsLib.CWDSP'UPGRADE_WARNING: Couldn't resolve default property of object CWDSP1.GaussNoise(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object z. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'z = (CWDSP1.GaussNoise(500, 1, 17))
z = (DSP.GaussNoise(500, 1, 17))
CWGraph1.PlotY(z)
End Sub
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
What is needed to make the early binding work ?
01-07-2009 07:40 PM
Hello Jason,
Is this happening on all ActiveX controls or only National Instruments controls?
Does the "Click for more" give you any useful information?
I looked around and found quite a few people on forums across the web with a similar problem using COM components in .NET, some of these suggested that using a non-visible control was the issue. Did you actually place the Graph on a form in the VB6 project or are you simply declaring it in the code?
It's strange that the upgrade wizrd wouldn't add a wrapper like .NET normally does with COM components, this could be an issue with the upgrade wizard.
01-08-2009 11:18 AM
Hi Jason,
Try this
Dim DSP As AxCWAnalysisControlsLib.AxCWDSP = New AxCWAnalysisControlsLib.AxCWDSP() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Controls.Add(DSP) 'you still have to add the control
End Sub
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.ClickDim z As Object
Try
z = DSP.GaussNoise(500, 1, 17)
Me.CWGraph1.PlotY(z)Exit Sub
Catch Exc As ExceptionMessageBox.Show(Exc.Message)
End Try
End Sub
Curt