How to open convert string to WiseJ Window Form?

0
0

Hi everyone, i want to open a form

I’m making a shortcut system, and I need the shortcut to know which form to open. Inside this control I’m waiting in the variable “form_name” the name of a form that exists in my project, how can I convert this string “form_name” to a Form object and open it? Something like this:

Dim frm As Form
Dim formName As String = “Form1”
formName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name & “.” & formName
frm = DirectCast(Activator.CreateInstance(Type.GetType(formName)), Form)
frm.Show()

 

Is this possible in WiseJ? Thanks!

  • You must to post comments
0
0

Hi Ruben,

Activator.CreateInstance has a string constructor you can use. See the following docs for an example.

https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance?view=net-5.0#System_Activator_CreateInstance_System_String_System_String_

Just make sure you’re using the fully qualified name of the control.

 

HTH,

Levie

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.