|
-
Jul 1st, 2008, 10:48 AM
#1
Thread Starter
Lively Member
[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.
-
Jul 1st, 2008, 10:58 AM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jul 1st, 2008, 11:01 AM
#3
Thread Starter
Lively Member
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.
-
Jul 1st, 2008, 11:09 AM
#4
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jul 1st, 2008, 11:25 AM
#5
Thread Starter
Lively Member
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.
-
Jul 1st, 2008, 11:26 AM
#6
Thread Starter
Lively Member
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..
-
Jul 1st, 2008, 11:27 AM
#7
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jul 1st, 2008, 11:30 AM
#8
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|