Results 1 to 5 of 5

Thread: [RESOLVED] how to enable/disable text box based on radio button value?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    46

    Resolved [RESOLVED] how to enable/disable text box based on radio button value?

    Hi i have 2 radio buttons,

    i) default value
    ii) specify value

    and 3 textboxes
    i)width
    ii)height
    iii)size

    the 3 texboxes are placed within a frame

    Now if the user chooses default value, i wan to gray out the 3 texboxes and disable them. However, when the user selects specify value, onli then will i enable the 3 textboxes. It can be done using IF THEN statements, however, which SUB should i place my statements in?

  2. #2

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    46

    Re: how to enable/disable text box based on radio button value?

    thks but i got the answer already

    just put the statements in the radio button 's click SUB will do..

    thks

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how to enable/disable text box based on radio button value?

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Option1_Click()
    4.     If Option1.Value = True Then
    5.         Text1.Enabled = False
    6.         Text2.Enabled = False
    7.         Text3.Enabled = False
    8.     End If
    9. End Sub
    10.  
    11. Private Sub Option2_Click()
    12.     If Option2.Value = True Then
    13.         Text1.Enabled = True
    14.         Text2.Enabled = True
    15.         Text3.Enabled = True
    16.     End If
    17. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Junior Member
    Join Date
    Aug 2014
    Posts
    22

    Re: [RESOLVED] how to enable/disable text box based on radio button value?

    I know it is very very old thread but i am looking the similar solution but i want to hide instead of enable/disable, how can i hide the textbox and label.. Please help?

  5. #5
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: [RESOLVED] how to enable/disable text box based on radio button value?

    Set the visible property instead of the enabled property.

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