Here is what I have but it isn't working if someone could point me in
the right direction I would greatly appreciate it.
Try
Dim objAssembly As Reflection.Asse mbly
ds.Tables("Main _Menu").Default View.RowFilter = "Menu_Name =
'" & sender.text & "'"
objAssembly =
objAssembly.Loa dFrom(ds.Tables ("Main_Menu").D efaultView.Item (0).Item("Assem bly"))
Dim typClsX As Type =
objAssembly.Get Type(ds.Tables( "Main_Menu").De faultView.Item( 0).Item("Assemb ly_Type"),
True, True)
objAssembly.Get ReferencedAssem blies()
objAssembly.Get CustomAttribute s(True)
objAssembly.Get EntryAssembly()
Dim cons() As ConstructorInfo
cons = typClsX.GetCons tructors(Bindin gFlags.CreateIn stance
Or BindingFlags.In stance Or BindingFlags.In vokeMethod Or
BindingFlags.Pu blic Or BindingFlags.No nPublic Or
BindingFlags.De claredOnly)
Dim Params() As ParameterInfo = cons(0).GetPara meters()
Dim MyString() As String = {"Test", "Tester"}
Dim Frm As New Form
Frm = Activator.Creat eInstance(typCl sX.BaseType,
BindingFlags.Cr eateInstance Or BindingFlags.In stance Or
BindingFlags.Pu blic Or BindingFlags.De claredOnly)
cons.Initialize ()
<b>Here is where I recieve the error</b>
Activator.Creat eInstance(cons( 0).Invoke(Bindi ngFlags.CreateI nstance Or
BindingFlags.De claredOnly Or BindingFlags.In stance Or
BindingFlags.Pu blic, Nothing, CType(New Object() {New String()
{"TEST"}, New String() {"Tester"}}, Object), Nothing))
Catch ex As Exception
MessageBox.Show (ex.ToString & " " & ex.Message & " " &
Err.Source & " " & Err.Description )
End Try
End Sub
End Class
<b>This is what I am trying to open. I am using general code right now
and will apply it to what I need after I figure it out.</b>
ublic Class Form1
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub SetValues(ByRef label1 As String, ByRef label2 As
String)
Me.Label2.Text = label1
Me.Label3.Text = label2
End Sub
Friend Sub New(ByVal label1 As String, ByVal label2 As String)
MyBase.New()
Me.Label2.Text = Label1
Me.Label3.Text = Label2
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows. Forms.Label
Friend WithEvents Label2 As System.Windows. Forms.Label
Friend WithEvents Label3 As System.Windows. Forms.Label
<System.Diagnos tics.DebuggerSt epThrough()Priv ate Sub
InitializeCompo nent()
Me.Label1 = New System.Windows. Forms.Label
Me.Label2 = New System.Windows. Forms.Label
Me.Label3 = New System.Windows. Forms.Label
Me.SuspendLayou t()
'
'Label1
'
Me.Label1.Locat ion = New System.Drawing. Point(0, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing. Size(640, 520)
Me.Label1.TabIn dex = 0
Me.Label1.Text = "This is a test...."
'
'Label2
'
Me.Label2.Locat ion = New System.Drawing. Point(16, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing. Size(224, 24)
Me.Label2.TabIn dex = 1
Me.Label2.Text = "Label2"
'
'Label3
'
Me.Label3.Locat ion = New System.Drawing. Point(16, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing. Size(320, 24)
Me.Label3.TabIn dex = 2
Me.Label3.Text = "Label3"
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(640, 518)
Me.Controls.Add (Me.Label3)
Me.Controls.Add (Me.Label2)
Me.Controls.Add (Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout (False)
End Sub
#End Region
Private Sub Label1_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Label1.Click
End Sub
End Class
the right direction I would greatly appreciate it.
Try
Dim objAssembly As Reflection.Asse mbly
ds.Tables("Main _Menu").Default View.RowFilter = "Menu_Name =
'" & sender.text & "'"
objAssembly =
objAssembly.Loa dFrom(ds.Tables ("Main_Menu").D efaultView.Item (0).Item("Assem bly"))
Dim typClsX As Type =
objAssembly.Get Type(ds.Tables( "Main_Menu").De faultView.Item( 0).Item("Assemb ly_Type"),
True, True)
objAssembly.Get ReferencedAssem blies()
objAssembly.Get CustomAttribute s(True)
objAssembly.Get EntryAssembly()
Dim cons() As ConstructorInfo
cons = typClsX.GetCons tructors(Bindin gFlags.CreateIn stance
Or BindingFlags.In stance Or BindingFlags.In vokeMethod Or
BindingFlags.Pu blic Or BindingFlags.No nPublic Or
BindingFlags.De claredOnly)
Dim Params() As ParameterInfo = cons(0).GetPara meters()
Dim MyString() As String = {"Test", "Tester"}
Dim Frm As New Form
Frm = Activator.Creat eInstance(typCl sX.BaseType,
BindingFlags.Cr eateInstance Or BindingFlags.In stance Or
BindingFlags.Pu blic Or BindingFlags.De claredOnly)
cons.Initialize ()
<b>Here is where I recieve the error</b>
Activator.Creat eInstance(cons( 0).Invoke(Bindi ngFlags.CreateI nstance Or
BindingFlags.De claredOnly Or BindingFlags.In stance Or
BindingFlags.Pu blic, Nothing, CType(New Object() {New String()
{"TEST"}, New String() {"Tester"}}, Object), Nothing))
Catch ex As Exception
MessageBox.Show (ex.ToString & " " & ex.Message & " " &
Err.Source & " " & Err.Description )
End Try
End Sub
End Class
<b>This is what I am trying to open. I am using general code right now
and will apply it to what I need after I figure it out.</b>
ublic Class Form1
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub SetValues(ByRef label1 As String, ByRef label2 As
String)
Me.Label2.Text = label1
Me.Label3.Text = label2
End Sub
Friend Sub New(ByVal label1 As String, ByVal label2 As String)
MyBase.New()
Me.Label2.Text = Label1
Me.Label3.Text = Label2
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows. Forms.Label
Friend WithEvents Label2 As System.Windows. Forms.Label
Friend WithEvents Label3 As System.Windows. Forms.Label
<System.Diagnos tics.DebuggerSt epThrough()Priv ate Sub
InitializeCompo nent()
Me.Label1 = New System.Windows. Forms.Label
Me.Label2 = New System.Windows. Forms.Label
Me.Label3 = New System.Windows. Forms.Label
Me.SuspendLayou t()
'
'Label1
'
Me.Label1.Locat ion = New System.Drawing. Point(0, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing. Size(640, 520)
Me.Label1.TabIn dex = 0
Me.Label1.Text = "This is a test...."
'
'Label2
'
Me.Label2.Locat ion = New System.Drawing. Point(16, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing. Size(224, 24)
Me.Label2.TabIn dex = 1
Me.Label2.Text = "Label2"
'
'Label3
'
Me.Label3.Locat ion = New System.Drawing. Point(16, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing. Size(320, 24)
Me.Label3.TabIn dex = 2
Me.Label3.Text = "Label3"
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(640, 518)
Me.Controls.Add (Me.Label3)
Me.Controls.Add (Me.Label2)
Me.Controls.Add (Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout (False)
End Sub
#End Region
Private Sub Label1_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Label1.Click
End Sub
End Class
Comment