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

Thread: Refresh

  1. #1
    Join Date
    May 2001
    Posts
    155

    Refresh

    how do you clear all the user made changes on a form. Like when the user checks a check box the next time they get that form that checkbox shouldn't still be checked. I've tried Form2.refresh but that doesn't do anything


    --Ant
    --------------------------------------------------
    check out my newest freeware
    E-mail me at: [email protected]
    for the address

  2. #2
    Join Date
    Jun 2001
    Location
    Memphis, TN
    Posts
    146

    Re: Refresh

    Are you using Form1.Show to display your form and Hide to make it disappear? The Show method automatically invokes the Load method/event, the Hide method does not invoke the Unload method/event. Try using Unload to make your window go away, that way when it is displayed again it is re-loaded into memory and (i think...) should use its default settings.


  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: unloading slow down

    Another way is to write a sub to reset your fields (it should be quicker than unloading and reloading the form):
    ie:
    inside a form

    public sub resetMe()
    'you may cycle throughout all controls
    'with

    'dim fMe as form
    'dim ctl as control
    'set fMe = thisformname
    'for each ctl in fMe
    'if typeOf ctl is checkbox then
    'ctl.checked = false
    'elseif
    '...
    'else
    '...
    'end if
    'next ctl

    'Or you may want to use specific code:
    Check1.Value = false
    Text1.Text = ""
    '...
    end sub



    To call this "strange" sub, you type the name of form, type a point and...look: it is a method of the form, now!
    ie:

    Form1.resetMe
    'or
    with Form1
    .resetMe
    end with




    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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

Featured