Call Private sub fromm mdiForm
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Call Private sub fromm mdiForm

  1. #1
    Join Date
    Jun 2013
    Posts
    14

    Call Private sub fromm mdiForm

    I have mdiForm1 and Form1 as child
    In Form1 I have a Menu mnuClear
    Sure you can call this menu from mdiForm (button in PictureBox)
    This procedure deletes the values ​​of local variables and they can not put in the module as Public Sub
    Form1 is a document that can be opened with the command New. So I variables dimensioned in Form1 and not in a module as Public. If they were Public then they would be the same value in all open Form1 ...

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,101

    Re: Call Private sub fromm mdiForm

    I'd make use of Properties here, instead of public / private variables.

    Just a suggestion

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,860

    Re: Call Private sub fromm mdiForm

    Properties is the way to go for sure but you can also use variables if that is the way you want to do it. The variables have to be public and have to be declared within the forms declarations section.

    You can not access private variables from any other form, class or module they are private to the container they are declared in.

    When access a public variable in a form or class you must prefix the from or class unto the variable name

    i.e. Form1.MyVar

    This method will allow you to have more than 1 copy of the form in memory and each have its own unique variables, still properties is a better choice.
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center