Reputation:
We upgraded our machines with a microsoft patch listed above and are now having issues with some winsock controls. While moving on to the new component library there were two issues that we faced:
This issue was resolved by adding a line License.Add(PrgID of the control) before adding the control.
Now the issue is when we try setting this control to an object of type mWinsock we get a runtime error Type Mismatch. Any thoughts?
Upvotes: 6
Views: 1921
Reputation: 5135
I encountered a similar issue when dynamically creating non-intrinsic controls in VB6. Perhaps Winsock is no longer considered intrinsic. Try declaring your variable as VBControlExtender instead of Winsock, as follows:
Option Explicit
Dim WithEvents objExt As VBControlExtender
Private Sub LoadControl()
Licenses.Add "MSWinsockLib.Winsock", "xydsfasfjewfe"
Set objExt = Controls.Add("MSWinsockLib.Winsock", "myCtl")
End Sub
Private Sub extObj_ObjectEvent(Info As EventInfo)
' Program the events of the control using Select Case.
Select Case Info.Name
Case "DataArrival"
' Do stuff
End Select
End Sub
See this MSDN article for more information.
Upvotes: 0
Reputation: 569
Take a look at "Description of the cumulative update rollup for the Visual Basic 6.0 Service Pack 6 Runtime Extended Files."
http://support.microsoft.com/kb/957924/
This December 30, 2008 update should remove and replace the faulty Dec 9 security update. It appears to deal with both 926857 and 957924.
958369 seems to be a Visual FoxPro KB article for the same faulty update (Dec 9). VFP uses many VB controls.
Upvotes: 2
Reputation: 32316
Since the interface signatures have changed, you will have to remove the component reference from the project, save and close VB6 completely, unregister the old control, register the new version from the patch, reopen your project and add the component back in. If you do this you'll most likely lose support for machines that don't have the patch installed (or you will have to install it as part of your installation package)
Of course, you can always declare the reference "As Object" if it's easier but your performance will drop a bit and you will lose support for WithEvents
Upvotes: 0
Reputation: 7194
You may need to add the control to the toolbox so that the VB6 project and form has a proper reference to it. You will need to do this even if you don't actually have it on the form at design time.
With the reference VB may not have all the information needed to resolve the methods and properties of the control at run-time
Upvotes: 1