Skip to content

Variables #732

Closed
Closed

Description

@itg-assistant

Dave Morris asked 2017-03-27 11:37:18 UTC

In VWG I was able to add the following code to the main form.

Public Shared ReadOnly Property MainForm() As Myapp
Get
Return CType(VWGContext.Current.MainForm, Myapp)
End Get
End Property

I was then able to access any variable, methods, functions on the main form from any other form using

Myapp.myvariable

Might be obvious but is there anyway of doing this in Wisej.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-03-27 15:22:44 UTC

    Hi Dave,

    with Wisej it should be a lot easier to achieve what you are trying to do here.

    Methods that can help you are e.g. Application.OpenForms, Application.OpenPages,
    Application.FindComponent, Application.MainPage, Application.Desktop etc.

    Hope that helps.

    Best regards
    Frank

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Dave Morris answered 2017-03-29 10:09:22 UTC

    Sorry, I'm probably being stupid. None of those options expose the variables that are set on the startup form. (I cant find them anyway !)

    How would you access a variable on the startup form from another form ?

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2017-03-29 20:07:37 UTC

    Hi Dave,

    maybe I just did not fully understand your needs. Here are various approaches that you can use
    to access variables in other windows:

    ((MyMainForm)Application.MainPage).MyVar

    or

    Public Shared ReadOnly Property MainForm() As Myapp Get Return CType(Application.MainPage, Myapp) End Get End Property

    or

    CType(Application.OpenForms("Window1"),Window1).MyVar

    Please note that OpenForms and OpenPages are collections and MainPage can be used as a reference to the main page
    if your app created one.

    I hope this clarifies it a bit. If it does not, please send a small test app and what you are trying to achieve to
    me at frankATiceteagroup.com

    Thanks !

    Best regards
    Frank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions