Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to close my second form by using the Hide method in C#.

It works in the Main class but not in the class of the form I want to close. I have the Hide method in a butoon event.

Both classes are public.

  • *Experts*
Posted

Can you give us some more details about the two classes and what's not working (a compile error, runtime error, or just not working as you think it should)?

 

If you can zip up the code that would be best.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted (edited)
Can you give us some more details about the two classes and what's not working (a compile error, runtime error, or just not working as you think it should)?

 

If you can zip up the code that would be best.

 

-Nerseus

 

Thanks,

I am new at programming so please exuse me for small mistakes.

 

[edit] Attachment deleted - please upload again with no exe or dll files. [/edit]

Edited by divil
  • 2 weeks later...
Posted
It would have been eisier if you had send us the whole thing. But that's ok. Why is this: SubMenu SUB = new SubMenu(); in the SubMenu class? So, you have one SubMenu instance that is already active, creating anothr one and you Hide() the new one. Is that what happens? Or doesn't the new one Hide() at all.
C#
Posted
It would have been eisier if you had send us the whole thing. But that's ok. Why is this: SubMenu SUB = new SubMenu(); in the SubMenu class? So, you have one SubMenu instance that is already active, creating anothr one and you Hide() the new one. Is that what happens? Or doesn't the new one Hide() at all.

 

I create the SUB object in the MainMenu class unxder the static method SubMenuScreen so when I press the escape key I access that method and Show the SubMenu Form that is inherited from the Form class. The MainMenu class is inherited from the Form class too.

When the SubMenu Class form is up I have another event in the SubMenu class that I have to create a SubMenu 0bject in order to access the Hide Method there.

 

So, when I play the game I press escape and then the submenu comes up. When I try to press the button on the submenu to access the hide methos from the SubMenu class to Hide the SubMenu it doesn't work. I noticed it only worked whe I put the Hide method in the MainMenu.SubMenuScreen Method but nowhere in the SubMenu class whitch is what I want to do .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...