+ Reply to Thread
Results 1 to 13 of 13

Can a command button make textboxes dissapear from a user form

  1. #1
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Can a command button make textboxes dissapear from a user form

    Hi All

    My New project for the week involves using checkboxes but before i get to that i have a query about making 2 textboxes disapear when they are no longer needed and a multipage subform appear

    The textboxes in question are

    txtstartbank and txttargfig

    I have thought about a couple of ways of doing it

    one is using just one userform as described above
    or making 2 userforms and unloading one then showing another

    Any thoughts would be greatfully recieved

    I think I would be able to do the latter way on my own but I would like to know if the first way is possible

    Jamesspeedway staking plan 1.1.xlsm
    Last edited by shakey775; 01-15-2012 at 05:16 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Can a command button make textboxes dissapear from a user form

    Hi,

    Why not just set the Textbox .Visible property to False
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can a command button make textboxes dissapear from a user form

    So just change your command button code for this
    Please Login or Register  to view this content.
    Regards,
    Simon Lloyd
    Google Me!
    Not all forums are the same - seek and you shall find

  4. #4
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Can a command button make textboxes dissapear from a user form

    Hi Richard
    Would that not make them permanantly invisible
    They are needed for initial data input but then are redundant and i would rather they not be there so as to reduce the chance of changing the data which would be catastrophic

  5. #5
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Can a command button make textboxes dissapear from a user form

    Ah nice one simon
    is that what you meant richard
    james

  6. #6
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can a command button make textboxes dissapear from a user form

    My suggestion sets the visible property to false but that will only take place when the button is clicked, when the form is next loaded they will be visible, this is what Richard means

    Regards,
    Simon Lloyd
    Google Me!

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can a command button make textboxes dissapear from a user form

    Lol, posting time difference!!
    Regards,
    Simon Lloyd
    Google Me!

  8. #8
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Can a command button make textboxes dissapear from a user form

    Thanks
    presumably I would do the opposite for the multi page thing set vis to false and then in button code set it to true
    lets give it a go

  9. #9
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Can a command button make textboxes dissapear from a user form

    That doesnt seem to work
    so i will leave it as is
    You have solved my main prob thanks very much
    I will put that in my note book

    James

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Can a command button make textboxes dissapear from a user form

    Quote Originally Posted by shakey775 View Post
    Ah nice one simon
    is that what you meant richard
    james
    Hi,

    What I meant was that you can choose to make the textbox invisible with the code I gave you. You can of course always make it visible again by setting the property to true.

    Only you can decide what event you want to use to run the code.

    I often use a single button as a toggle to either make a Userform control visible or not depending on its current state. e.g.

    Please Login or Register  to view this content.
    But you can of course use any event or button you want.
    When you initialise the UserForm you can use the initialise event to set the control visible property to true if that's what you want.
    Last edited by Richard Buttrey; 01-15-2012 at 09:20 AM.

  11. #11
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Can a command button make textboxes dissapear from a user form

    So instead of a command button i could use a toggle button
    That sounds useful

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Can a command button make textboxes dissapear from a user form

    Hi,

    Sort of. What I meant was that the command button IS that 'toggle button'.
    There's no such animal as a 'Toggle button' per se.

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Can a command button make textboxes dissapear from a user form

    Rather than blank spaces created in the form when making a TextBox invisible I would go for disabling it
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1