dcsimg
Results 1 to 13 of 13

Thread: Me.Hide or frmMyForm.Hide

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Me.Hide or frmMyForm.Hide

    I want to close a form that was opened while a second form is open. I would expect that Me.Hide or Me.Close would work.

    However, .Hide or .Close do not come up as options.

    This is in VB.Net.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,121

    Re: Me.Hide or frmMyForm.Hide

    Can you show us the code you tried. ‘Me’ has different meanings depending on where you call it from. Also you need to check your ShutDown mode.

    Project—>Properties—>Application—> ShutDown mode

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,893

    Re: Me.Hide or frmMyForm.Hide

    frmMyForm would be the default instance. That may be the right one, but from your description, probably not. If it isn't the right one, you definitely wouldn't want to use it.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Re: Me.Hide or frmMyForm.Hide

    The only code that I use is Me.

    After that, the list does not include Hide or Close.

    That is all that I know. I must not be doing something to add a reference or something.
    Attached Images Attached Images  

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Re: Me.Hide or frmMyForm.Hide

    The only code that I use is Me.

    After that, the list does not include Hide or Close.

    That is all that I know. I must not be doing something to add a reference or something.

  6. #6
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,434

    Re: Me.Hide or frmMyForm.Hide

    Can't you read that???? Post the actual code, put it between code tags by clicking either the "VB" or "#" icons

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Re: Me.Hide or frmMyForm.Hide

    Sorry, I am new at this forum. This is the only code that I have. After Me. there are many options starting from Adapter to XSelectPath. The closest to what I want to do is Hide. But I simply want to close or hide the form.

    Code:
       Protected Sub btnClose_Click(sender As Object, e As System.EventArgs) Handles btnClose.Click
            Me. (nothing applies here)
       End Sub

  8. #8
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,434

    Re: Me.Hide or frmMyForm.Hide

    Need to know where this is located.

    After staring real hard at the pic you posted it looks like this is in a Partial Class. You can't you Me to represent the Form object like that. Why isn't the Button Click Event inside the Form object. If you move it there then it will work.

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,893

    Re: Me.Hide or frmMyForm.Hide

    Most forms are partial classes, so that's not totally out of the question. Generally, it is the .designer.vb that gets the Partial Class designation, but it doesn't HAVE to be that way.

    What does have to be the case is that it has to be at least part of a form class, but it would have to be for that button to work...in most cases. I'm intrigued by the use of Protected on that method. It's not necessarily right or wrong, but does suggest that this is part of some kind of novel inheritance tree. It doesn't sound like it is necessarily a form, but it might be something derived from a form in some fashion, so you might be able to get away with MyBase.Close, though if that worked, it would be best if you understood why, and I certainly don't from what has been shown thus far.

    The forum software tends to shrink screenshots down to the point where they become unreadable, so pasting code, as you did, is FAR better when showing code. Screenshots of forms are a different matter, but code doesn't work well as a screenshot.
    My usual boring signature: Nothing

  10. #10
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,676

    Re: Me.Hide or frmMyForm.Hide

    I think that you have failed to provide some very important information. I enlarged your screenshot and, despite everything being very fuzzy, it appeared that your class inherits System.Web.UI.Page, which means that you are dealing with a page in a Web Forms app and not a form in Windows Forms app. The two are very different.

    If, instead of lazily copying your whole screen, including all that empty space, you had copied just the small part with the code in it, we would have been able to see that easily in the first place. New or not, you can still consider the fact that it's pointless posting a huge image with loads of empty space when all you need is a small pit of code. You appear to be using Windows 10 and both the Snipping Tool and Snip & Sketch enable you to easily copy a small portion of the screen in moments. If you'd like us to volunteer our time to helo you, the least you can do is take the time to make doing so as easy as possible.

  11. #11

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Re: Me.Hide or frmMyForm.Hide

    Name:  No hide option003.jpg
Views: 41
Size:  24.2 KB
    Sorry about the whole screen shot. It was not being lazy. I actually spent about a half hour trying to capture the list of options, but it closed every time I opened my screenshot software. Since, I did figure out how to preset an area so this might have worked. I do not see it here however, so if 175637 is not a screen shot, please do not waste your time with this. There is nothing new in it. Me.Close does not seem to be an option although everything that I have searched says it should be. Thank you for your help.

  12. #12
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,676

    Re: Me.Hide or frmMyForm.Hide

    Quote Originally Posted by thorskonnord View Post
    Me.Close does not seem to be an option although everything that I have searched says it should be.
    Then your research has all been a waste of time. Are you trying to create a Windows application or a web application? What you have there is a web application. The Page class has no Close method, as the documentation clear indicates:

    https://docs.microsoft.com/en-au/dot...rk-4.8#methods

    You can have a web page close the browser tab/window it is displayed in but that would be done in JavaScript on the client, not on the server. How would hiding a web page work?

    I think that you must want a Windows app, which means that you can ditch that project altogether and create a new one of the correct type. If you actually do want a web app then you need to learn how they work, because it appears that you have been researching Windows apps.

  13. #13

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Re: Me.Hide or frmMyForm.Hide

    Thank you jmcihinney, you gave me the answer. I was opening the form as a popup using JavaScript.

    Code:
    Dim url As String = "Income.aspx"
    Dim s As String = "window.open('" & url + "', 'popup_window', 'width=800,height=800,left=100,top=100,resizable=yes');"
    ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
    I needed to use JavaScript to close it.

    Code:
    Dim s As String = "window.close('" & url + "',');"
    ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
    This does not actually close it, but it hides it. So, that is a start.

    Thank you!

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
  •  



Featured


Click Here to Expand Forum to Full Width