RE: Passing a constructor parameter with Activator.CreateInstance
- From: v-jetan@xxxxxxxxxxxxxxxxxxxx ("Jeffrey Tan[MSFT]")
- Date: Tue, 28 Jun 2005 07:44:16 GMT
Hi Josh,
Thanks for your feedback.
For other inherited form, we can pass the arguments like this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim args(0) As Object
args(0) = New Object
args(0) = 2
Dim f As Form2 = CType(Activator.CreateInstance(GetType(Form2),
args), Form2)
f.Show()
End Sub
Public Class Form2
Inherits System.Windows.Forms.Form
Sub New(ByVal SearchID As Int32)
MessageBox.Show(SearchID.ToString())
End Sub
End Class
It works well on my side. Thanks
==================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.
- Follow-Ups:
- References:
- Passing a constructor parameter with Activator.CreateInstance
- From: jmhmaine
- RE: Passing a constructor parameter with Activator.CreateInstance
- From: "Jeffrey Tan[MSFT]"
- RE: Passing a constructor parameter with Activator.CreateInstance
- From: jmhmaine
- Passing a constructor parameter with Activator.CreateInstance
- Prev by Date: Created custom caption bar - need help with caption button positio
- Next by Date: GDI+ drawing speed within MFC dialog (help)
- Previous by thread: RE: Passing a constructor parameter with Activator.CreateInstance
- Next by thread: RE: Passing a constructor parameter with Activator.CreateInstance
- Index(es):