activating a form

  • Thread starter Thread starter Dave Beseke
  • Start date Start date
D

Dave Beseke

I have a VB.Net assembly that is used to load another
assembly written in C# via the following code in the 1st
form's load function:

Dim sLocation As String
sLocation= "HTTP://myserver/asm2.dll"
Dim formAsm As [Assembly] = [Assembly].LoadFrom(sLocation)
Dim formtype As Type = formAsm.GetType("asm2.Form1")
Dim FormObj As Object
FormObj = Activator.CreateInstance(formtype)
Dim Form2 As Form = CType(FormObj, Form)
Opacity = 0
Hide()
Form2.Visible = True
Form2.Activate()

I've tried several different way to make the loaded form
the active form, and nothing seems to work. Any ideas?
 
I have a VB.Net assembly that is used to load another
assembly written in C# via the following code in the 1st
form's load function:

Dim sLocation As String
sLocation= "HTTP://myserver/asm2.dll"
Dim formAsm As [Assembly] = [Assembly].LoadFrom(sLocation)
Dim formtype As Type = formAsm.GetType("asm2.Form1")
Dim FormObj As Object
FormObj = Activator.CreateInstance(formtype)
Dim Form2 As Form = CType(FormObj, Form)
Opacity = 0
Hide()
Form2.Visible = True
Form2.Activate()

I've tried several different way to make the loaded form
the active form, and nothing seems to work. Any ideas?

I use this technique, although with MDI. So I am setting Form2.MDIParent =
Me, setting the WindowState, and calling Form2.Show().

Best Regards,
Andy
 
Thanks. I just figured out what I was doing wrong. Turns out the code
works fine, but it needs to be in the activated event instead of the
load event. If I put it in the load event, the calling form will always
activate itself after I issue the activation for my other form.
 
Back
Top