Results 1 to 5 of 5

Thread: [2.0] Hide frmMain from frmEdit?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    40

    [2.0] Hide frmMain from frmEdit?

    I'm working on a program, and I'm completely done, except for one small problem. I need to hide frmMain if a function in frmEdit is successful.

    Code:
                try
                {
                    FileStream fs = File.Open(Interaction.Command(), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
                    BinaryReader br = new BinaryReader(fs);
                    BinaryWriter bw = new BinaryWriter(fs);
    
                    //Go to offset
                    br.BaseStream.Position = 444;
                    //Show string
                    strString = br.ReadString();
                    txtSString.Text = strString;
                    //Close br
                    br.Close();
    
                    frmMain.Hide();
                }
    However, it seems that frmMain.Hide(); doesnt work, is there a bit of code that could do this?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] Hide frmMain from frmEdit?

    Use a break point on the "frmMain.Hide();" line and see if nothing stops the code from being executed
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    40

    Re: [2.0] Hide frmMain from frmEdit?

    Tried that, it gives this error:
    "An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Hide()"

    Ugh, I've dug through tons of results on forums and google, nothing. How about a way to call a function in the code of frmMain, from frmEdit? I suppose that's not possible either, and it's just impossible to hide a form unless you do it on that form itself.

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] Hide frmMain from frmEdit?

    This means frmMain is a class name, you must use create an object to use it
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Hide frmMain from frmEdit?

    You are obviously not fully familiar with the principles of OOP. I suggest that you read the "Forms in VB.NET" tutorial in my signature. The code examples are in VB but the principles are all exactly the same. You can use one of the links in my signature to convert the code examples if required.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width