Results 1 to 8 of 8

Thread: [RESOLVED] combo box problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    68

    Resolved [RESOLVED] combo box problem

    i have a combobox...i have list of elements in it...on click of one particular item say "new" one of the textfields in my form say text1.text should get disabled.

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

    Re: combo box problem

    Whats the question?
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    68

    Re: combo box problem

    i need a code to disable a text field in my form on selecting an item from a combo box...
    Last edited by Sgiri1; Jul 1st, 2008 at 11:09 AM.

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

    Re: combo box problem

    Use the combobox click event and in there just set your textbox's .enable property to False.
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    68

    Re: combo box problem

    Private Sub Combo1_click()
    If Combo1.Text = "new" Then
    Text1.Enabled = False
    End If
    End Sub

    Private Sub Form_Load()
    Combo1.AddItem "new"
    Combo1.AddItem "old1"
    Combo1.AddItem "old2"
    Combo1.ListIndex = 0
    End Sub


    is this what u said? if so this doesn't seem to be working...the text box still stays enabled...
    Last edited by Sgiri1; Jul 1st, 2008 at 11:29 AM.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    68

    Re: combo box problem

    Private Sub Combo1_click()
    If Combo1.Text = "new" Then
    Text1.Enabled = False
    End If
    End Sub

    Private Sub Form_Load()
    Combo1.AddItem "new"
    Combo1.AddItem "old1"
    Combo1.AddItem "old2"
    Combo1.ListIndex = 0
    End Sub

    if give this code..then on the click of all the three items the text field is disabled...but i jus want it to be disabled when i click new..

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

    Re: combo box problem

    Works perfect for me. You werent using the Click event like I mentioned.
    Code:
    Option Explicit
    
    Private Sub Combo1_Click()
        If Combo1.Text = "new" Then
            Text1.Enabled = False
        Else
            Text1.Enabled = True
        End If
    End Sub
    
    Private Sub Form_Load()
        Combo1.AddItem "new"
        Combo1.AddItem "old1"
        Combo1.AddItem "old2"
        Combo1.ListIndex = 0
    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

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    68

    Re: combo box problem

    works fine thanks..

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