StrataFrame Forum

How to Acces to a Mainform ?

http://forum.strataframe.net/Topic23695.aspx

By Rainer Kempf, RK - 6/26/2009

Hello ,



I hope somebody can help me.



How can i acess to a mainform which is added over InitApplication in AppMain ?



e.Forms.Add(GetType(MKSApplication.MKSBaseApplicationFormWithNB))



I need a Reference to this form.



thanks



Rainer






By Greg McGuffey - 6/26/2009

I believe it is:



StrataFrameApplication.MainForm




If you need access to something specific on that form, you'll need to do a cast, as this property is just a standard windows form.
By Rainer Kempf, RK - 6/27/2009

Hello Greg,

Thank you for your anwser, but problem not solved in this way.

.Forms.Add(GetType(MKSApplication.MKSBaseApplicationFormWithNB))

I had a baseclass of MKSApplication.MKSBaseApplicationFormWithNB

in this Baseclass i had a lot of public Properties on which i want to access.

So when i try to access to Strataframe.application.mainform i can't see this properties.

How to handel this ?

thanks

Rainer

By Greg McGuffey - 6/29/2009

You'll need to cast the MainForm to you're type:



VB.NET

DirectCast(StrataFrameApplication.MainForm,MKSApplication.MKSBaseApplicationFormWithNB)




C#

(MKSApplication.MKSBaseApplicationFormWithNB) StrataFrameApplication.MainForm;
By Rainer Kempf, RK - 6/29/2009

Hello Greg



Sorry but it seems i am to stupid to completly understand.



i did following :



   e.Forms.Add(GetType(MKS.Application.MKSBAseApplicationFormWithNB))



Dim LoMyForm As MKS.Application.MKSBAseApplicationFormWithNB

LoMyForm = DirectCast(StrataFrameApplication.MainForm, MKS.Application.MKSBAseApplicationFormWithNB)



And if i try to access to MyLoForm i see nothing.





But in MKSBAseApplicationFormWithNB exist Public properties like pmks_load_ribbonbar



But i can't see this property after casting.



So what i made wrong ?





thanks for your patience and help



Rainer











   


By Rainer Kempf, RK - 6/29/2009

Hello Greg



Thanks for your help



I solved prolem over a Ctype



thanks



Rainer
By Greg McGuffey - 6/29/2009

Not sure why a CType would work instead of a DirectCast (CType calls DirectCast internally if I remember correctly), but I'm glad you got it working.