How to Acces to a Mainform ?


Author
Message
Rainer Kempf, RK
Rainer Kempf, RK
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: StrataFrame Users
Posts: 55, Visits: 1.4K
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







Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
Rainer Kempf, RK
Rainer Kempf, RK
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: StrataFrame Users
Posts: 55, Visits: 1.4K
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

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
You'll need to cast the MainForm to you're type:



VB.NET

DirectCast(StrataFrameApplication.MainForm,MKSApplication.MKSBaseApplicationFormWithNB)




C#

(MKSApplication.MKSBaseApplicationFormWithNB) StrataFrameApplication.MainForm;

Rainer Kempf, RK
Rainer Kempf, RK
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: StrataFrame Users
Posts: 55, Visits: 1.4K
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











   



Rainer Kempf, RK
Rainer Kempf, RK
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: StrataFrame Users
Posts: 55, Visits: 1.4K
Hello Greg



Thanks for your help



I solved prolem over a Ctype



thanks



Rainer
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search