Click here to Skip to main content
15,890,512 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Webbrowser.navigate control is parsing url "&" Pin
rss_bateman31-Dec-08 3:25
rss_bateman31-Dec-08 3:25 
QuestionWindow state problem Pin
Pankaj Garg30-Dec-08 1:49
Pankaj Garg30-Dec-08 1:49 
AnswerRe: Window state problem Pin
Jon_Boy30-Dec-08 3:09
Jon_Boy30-Dec-08 3:09 
QuestionLoad UserControl from existing DLL file Pin
Indra PR30-Dec-08 0:12
Indra PR30-Dec-08 0:12 
AnswerRe: Load UserControl from existing DLL file Pin
Tom Deketelaere30-Dec-08 0:19
professionalTom Deketelaere30-Dec-08 0:19 
GeneralRe: Load UserControl from existing DLL file Pin
Indra PR30-Dec-08 0:45
Indra PR30-Dec-08 0:45 
AnswerRe: Load UserControl from existing DLL file Pin
Jon_Boy30-Dec-08 2:48
Jon_Boy30-Dec-08 2:48 
GeneralRe: Load UserControl from existing DLL file Pin
Indra PR30-Dec-08 6:59
Indra PR30-Dec-08 6:59 
I made a function like this:
Public Shared Function LoadAssembly(ByVal AssemblyPath As String, ByVal ClassName As String) As Object
        Dim objAssembly As Reflection.Assembly

        objAssembly = Reflection.Assembly.LoadFrom(AssemblyPath)

        Try
            LoadAssembly = objAssembly.CreateInstance(ClassName, True)
        Catch ex As Exception
            MsgBox(ex.Message)
            Return Nothing
        End Try

        If LoadAssembly Is Nothing Then
            MsgBox("Assembly : " & AssemblyPath & vbNewLine & "Class : " & ClassName)
            Return Nothing
        End If
End Function


And I call the function in the form load of the new project:
Dim frm As Form

Try
        frm = LoadAssembly("C:\WindowsControlLibrary1.dll", "WindowsControlLibrary1.Form1")
        Me.IsMdiContainer = True
        frm.MdiParent = Me
        frm.Dock = DockStyle.Fill
        frm.Show()
Catch ex As Exception
        MsgBox(ex.Message)
End Try


In order to make it works, I create 1 form inside the WindowsControlLibrary1.dll that I name it Form1. But when I want to add the UserControl1 inside the form, I don't know what to do next.
Dim usc As Form

Try
        usc = DirectCast(LoadAssembly("C:\WindowsControlLibrary1.dll", "WindowsControlLibrary1.UserControl1"), Form)
        Me.IsMdiContainer = True
        usc.MdiParent = Me
        usc.Dock = DockStyle.Fill
        usc.Show()
Catch ex As Exception
        MsgBox(ex.Message)
End Try


This script returned an error:
Unable to cast object of type 'WindowsControlLibrary1.UserControl1' to type 'System.Windows.Forms.Form'.


I need to add the UserControl1 on my project form. Is there any UserControl Container or something that I should add on my form? D'Oh! | :doh:
GeneralRe: Load UserControl from existing DLL file Pin
Dave Kreskowiak30-Dec-08 7:51
mveDave Kreskowiak30-Dec-08 7:51 
GeneralRe: Load UserControl from existing DLL file Pin
Indra PR31-Dec-08 4:07
Indra PR31-Dec-08 4:07 
GeneralRe: Load UserControl from existing DLL file Pin
Jon_Boy31-Dec-08 4:37
Jon_Boy31-Dec-08 4:37 
GeneralRe: Load UserControl from existing DLL file Pin
Indra PR31-Dec-08 17:15
Indra PR31-Dec-08 17:15 
GeneralRe: Load UserControl from existing DLL file Pin
Indra PR1-Jan-09 17:22
Indra PR1-Jan-09 17:22 
QuestionDatagridview combo box Binding problem Pin
Amit Agarrwal29-Dec-08 21:57
Amit Agarrwal29-Dec-08 21:57 
AnswerRe: Datagridview combo box Binding problem Pin
Jay Royall30-Dec-08 0:01
Jay Royall30-Dec-08 0:01 
AnswerRe: Datagridview combo box Binding problem Pin
Indra PR30-Dec-08 0:29
Indra PR30-Dec-08 0:29 
Questionrestrict installations of other program Pin
Nanda_MR29-Dec-08 21:16
Nanda_MR29-Dec-08 21:16 
AnswerRe: restrict installations of other program Pin
Tom Deketelaere29-Dec-08 23:02
professionalTom Deketelaere29-Dec-08 23:02 
GeneralRe: restrict installations of other program Pin
Nanda_MR30-Dec-08 20:40
Nanda_MR30-Dec-08 20:40 
GeneralRe: restrict installations of other program Pin
Tom Deketelaere31-Dec-08 1:49
professionalTom Deketelaere31-Dec-08 1:49 
QuestionCompact and Repair Access database using vb.net 2005 without using COM objects Pin
srilathach29-Dec-08 19:55
srilathach29-Dec-08 19:55 
AnswerRe: Compact and Repair Access database using vb.net 2005 without using COM objects Pin
Dave Kreskowiak30-Dec-08 3:54
mveDave Kreskowiak30-Dec-08 3:54 
Question[Message Deleted] Pin
Parag Raibagkar29-Dec-08 19:38
Parag Raibagkar29-Dec-08 19:38 
AnswerRe: Exporting data from vb form to HTML page Pin
Dave Kreskowiak30-Dec-08 3:48
mveDave Kreskowiak30-Dec-08 3:48 
Questionhow to display an image on Crystal report from a database Using VB.NET Pin
amna_elahi200229-Dec-08 18:36
amna_elahi200229-Dec-08 18:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.