Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB6 Interop » General » Downloads
 
Add your own
alternative version

Interop Forms Toolkit 2.0 Tutorial

, 16 Jun 2007 CPOL
Interop Forms Toolkit 2.0 is a new bridging tool allowing developers to use .NET Forms and .NET UserControls in VB6. This tutorial demonstrates how to add webservices, multithreading, and XAML to VB6 projects. It also provides custom C# Interop UserControl templates for use with the Toolkit.
csharp_samples.zip
XamlUserControl
bin
Debug
XamlUserControl.dll
images
roundcornersheet.png
Star.png
obj
Debug
TempPE
UserControl1.baml
XamlUserControl.dll
Properties
Settings.settings
CSDailyDilbertControl
CSDailyDilbertControl
bin
Debug
CSDailyDilbertControl.dll
CSDailyDilbertControl.tlb
Dilbert.bmp
InteropUserControl.bmp
InteropUserControl.manifest
InteropUserControl.res
obj
Debug
CSDailyDilbertControl.dll
Refactor
TempPE
Web References.DDService.Reference.cs.dll
Properties
Settings.settings
Web References
DDService
DailyDiblert.disco
DailyDiblert.wsdl
Reference.map
CSMultithreadedControl
CSMultithreadedControl
bin
Debug
obj
Debug
Refactor
TempPE
Properties
CSXamlEmbeddedForm
CSXamlEmbeddedForm
bin
Debug
CSXamlEmbeddedForm.dll
CSXamlEmbeddedForm.tlb
PresentationCore.dll
System.Printing.dll
XamlUserControl.dll
InteropForm Wrapper Classes
obj
Debug
CSXamlEmbeddedForm.dll
Refactor
TempPE
Documents and Settings
jashley.CORPORATE
My Documents
Visual Studio 2005
Projects
CSMultithreadedControl
CSMultithreadedControl
bin
Debug
obj
Debug
Refactor
TempPE
Properties
bin
Debug
obj
Debug
Refactor
TempPE
Properties
InteropUserControl.bmp
InteropUserControl.manifest
InteropUserControl.res
csinteropusercontrolitemtemplate.zip
__TemplateIcon.ico
InteropUserControl.vstemplate
csinteropusercontrolprojecttemplate.zip
InteropUserControl.manifest
InteropUserControl.res
__TemplateIcon.ico
csinteropusercontrollibrary.vstemplate
InteropUserControl.bmp
source_code.zip
DailyDilbertControl
DailyDilbertControl
bin
Debug
DailyDilbertControl.dll
DailyDilbertControl.tlb
Dilbert.bmp
InteropUserControl.bmp
InteropUserControl.manifest
InteropUserControl.RES
My Project
Application.myapp
Settings.settings
obj
Debug
DailyDilbertControl.dll
TempPE
My Project.Resources.Designer.vb.dll
Web References.DDService.Reference.vb.dll
Resources
Web References
DDService
DailyDiblert.disco
DailyDiblert.wsdl
Reference.map
XamlUserControl.dll
roundcornersheet.png
Star.png
UserControl1.baml
XamlUserControl.dll
Settings.settings
MultithreadedControl
bin
Debug
MultithreadedControl.dll
MultithreadedControl.tlb
InteropUserControl.bmp
InteropUserControl.manifest
InteropUserControl.res
My Project
Application.myapp
obj
Debug
MultithreadedControl.dll
TempPE
VB6Project
Form1.frm
Project1.vbp
Project1.vbw
XamlEmbeddedForm
bin
Debug
PresentationCore.dll
System.Printing.dll
XamlEmbeddedForm.dll
XamlEmbeddedForm.tlb
XamlUserControl.dll
XamlUserControl.pdb
zh-CHS
PresentationCore.resources.dll
System.Printing.resources.dll
InteropForm Wrapper Classes
My Project
Application.myapp
Settings.settings
obj
Debug
TempPE
XamlEmbeddedForm.dll
VB6Project
Form1.frm
Project1.vbp
Project1.vbw
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.42
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.42.
'
Namespace DDService
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42"),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Web.Services.WebServiceBindingAttribute(Name:="DailyDilbertSoap", [Namespace]:="http://tempuri.org/")>  _
    Partial Public Class DailyDilbert
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
        
        Private DailyDilbertImageOperationCompleted As System.Threading.SendOrPostCallback
        
        Private DailyDilbertImagePathOperationCompleted As System.Threading.SendOrPostCallback
        
        Private useDefaultCredentialsSetExplicitly As Boolean
        
        '''<remarks/>
        Public Sub New()
            MyBase.New
            Me.Url = Global.DailyDilbertControl.My.MySettings.Default.DailyDilbertControl_DDService_DailyDilbert
            If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then
                Me.UseDefaultCredentials = true
                Me.useDefaultCredentialsSetExplicitly = false
            Else
                Me.useDefaultCredentialsSetExplicitly = true
            End If
        End Sub
        
        Public Shadows Property Url() As String
            Get
                Return MyBase.Url
            End Get
            Set
                If (((Me.IsLocalFileSystemWebService(MyBase.Url) = true)  _
                            AndAlso (Me.useDefaultCredentialsSetExplicitly = false))  _
                            AndAlso (Me.IsLocalFileSystemWebService(value) = false)) Then
                    MyBase.UseDefaultCredentials = false
                End If
                MyBase.Url = value
            End Set
        End Property
        
        Public Shadows Property UseDefaultCredentials() As Boolean
            Get
                Return MyBase.UseDefaultCredentials
            End Get
            Set
                MyBase.UseDefaultCredentials = value
                Me.useDefaultCredentialsSetExplicitly = true
            End Set
        End Property
        
        '''<remarks/>
        Public Event DailyDilbertImageCompleted As DailyDilbertImageCompletedEventHandler
        
        '''<remarks/>
        Public Event DailyDilbertImagePathCompleted As DailyDilbertImagePathCompletedEventHandler
        
        '''<remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DailyDilbertImage", RequestNamespace:="http://tempuri.org/", ResponseNamespace:="http://tempuri.org/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>  _
        Public Function DailyDilbertImage() As <System.Xml.Serialization.XmlElementAttribute(DataType:="base64Binary")> Byte()
            Dim results() As Object = Me.Invoke("DailyDilbertImage", New Object(-1) {})
            Return CType(results(0),Byte())
        End Function
        
        '''<remarks/>
        Public Overloads Sub DailyDilbertImageAsync()
            Me.DailyDilbertImageAsync(Nothing)
        End Sub
        
        '''<remarks/>
        Public Overloads Sub DailyDilbertImageAsync(ByVal userState As Object)
            If (Me.DailyDilbertImageOperationCompleted Is Nothing) Then
                Me.DailyDilbertImageOperationCompleted = AddressOf Me.OnDailyDilbertImageOperationCompleted
            End If
            Me.InvokeAsync("DailyDilbertImage", New Object(-1) {}, Me.DailyDilbertImageOperationCompleted, userState)
        End Sub
        
        Private Sub OnDailyDilbertImageOperationCompleted(ByVal arg As Object)
            If (Not (Me.DailyDilbertImageCompletedEvent) Is Nothing) Then
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
                RaiseEvent DailyDilbertImageCompleted(Me, New DailyDilbertImageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub
        
        '''<remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DailyDilbertImagePath", RequestNamespace:="http://tempuri.org/", ResponseNamespace:="http://tempuri.org/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>  _
        Public Function DailyDilbertImagePath() As String
            Dim results() As Object = Me.Invoke("DailyDilbertImagePath", New Object(-1) {})
            Return CType(results(0),String)
        End Function
        
        '''<remarks/>
        Public Overloads Sub DailyDilbertImagePathAsync()
            Me.DailyDilbertImagePathAsync(Nothing)
        End Sub
        
        '''<remarks/>
        Public Overloads Sub DailyDilbertImagePathAsync(ByVal userState As Object)
            If (Me.DailyDilbertImagePathOperationCompleted Is Nothing) Then
                Me.DailyDilbertImagePathOperationCompleted = AddressOf Me.OnDailyDilbertImagePathOperationCompleted
            End If
            Me.InvokeAsync("DailyDilbertImagePath", New Object(-1) {}, Me.DailyDilbertImagePathOperationCompleted, userState)
        End Sub
        
        Private Sub OnDailyDilbertImagePathOperationCompleted(ByVal arg As Object)
            If (Not (Me.DailyDilbertImagePathCompletedEvent) Is Nothing) Then
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
                RaiseEvent DailyDilbertImagePathCompleted(Me, New DailyDilbertImagePathCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub
        
        '''<remarks/>
        Public Shadows Sub CancelAsync(ByVal userState As Object)
            MyBase.CancelAsync(userState)
        End Sub
        
        Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean
            If ((url Is Nothing)  _
                        OrElse (url Is String.Empty)) Then
                Return false
            End If
            Dim wsUri As System.Uri = New System.Uri(url)
            If ((wsUri.Port >= 1024)  _
                        AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then
                Return true
            End If
            Return false
        End Function
    End Class
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")>  _
    Public Delegate Sub DailyDilbertImageCompletedEventHandler(ByVal sender As Object, ByVal e As DailyDilbertImageCompletedEventArgs)
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42"),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code")>  _
    Partial Public Class DailyDilbertImageCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs
        
        Private results() As Object
        
        Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
            MyBase.New(exception, cancelled, userState)
            Me.results = results
        End Sub
        
        '''<remarks/>
        Public ReadOnly Property Result() As Byte()
            Get
                Me.RaiseExceptionIfNecessary
                Return CType(Me.results(0),Byte())
            End Get
        End Property
    End Class
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")>  _
    Public Delegate Sub DailyDilbertImagePathCompletedEventHandler(ByVal sender As Object, ByVal e As DailyDilbertImagePathCompletedEventArgs)
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42"),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code")>  _
    Partial Public Class DailyDilbertImagePathCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs
        
        Private results() As Object
        
        Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
            MyBase.New(exception, cancelled, userState)
            Me.results = results
        End Sub
        
        '''<remarks/>
        Public ReadOnly Property Result() As String
            Get
                Me.RaiseExceptionIfNecessary
                Return CType(Me.results(0),String)
            End Get
        End Property
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

James Ashley
Software Developer (Senior)
United States United States
James is a program writer for a respectable software company. He is also a Microsoft MVP.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 16 Jun 2007
Article Copyright 2007 by James Ashley
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid