Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Locking DBCombo Box


Reply
 
Thread Tools Display Modes
  #1  
Old 11-22-2006, 07:41 AM
nkechifesie nkechifesie is offline
Regular
 
Join Date: Nov 2006
Posts: 62
Default Locking DBCombo Box


I need to lock the DbCombo text box so no one can enter anything but they can use the Drop down list. How do I go about this? I tried making the Locked property True but it disabled the Drop down list, I couldnt pick any item from the drop down list. Please could you assist me.
thank you
Reply With Quote
  #2  
Old 11-22-2006, 08:09 AM
Timbo's Avatar
Timbo Timbo is offline
Green-Eyed

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261
Default

What software are you developing in...
__________________
"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote
  #3  
Old 11-22-2006, 08:14 AM
nkechifesie nkechifesie is offline
Regular
 
Join Date: Nov 2006
Posts: 62
Default

Visual Basic 6
Reply With Quote
  #4  
Old 11-22-2006, 08:22 AM
PianoMan's Avatar
PianoMan PianoMan is offline
Contributor
 
Join Date: Oct 2003
Location: NC, USA
Posts: 470
Default

Quote:
Originally Posted by nkechifesie
I need to lock the DbCombo text box so no one can enter anything but they can use the Drop down list. How do I go about this? I tried making the Locked property True but it disabled the Drop down list, I couldnt pick any item from the drop down list. Please could you assist me.
thank you
Set the Style Property to 2 - dbDropdown List.
__________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ---Rich Cook
Reply With Quote
  #5  
Old 11-22-2006, 08:32 AM
nkechifesie nkechifesie is offline
Regular
 
Join Date: Nov 2006
Posts: 62
Default

It still didnt work.
Reply With Quote
  #6  
Old 11-22-2006, 08:58 AM
PianoMan's Avatar
PianoMan PianoMan is offline
Contributor
 
Join Date: Oct 2003
Location: NC, USA
Posts: 470
Default

Quote:
Originally Posted by nkechifesie
It still didnt work.
What didn't happen that you expected to happen? Setting the Style Property to 2 will allow a user to choose something from the list, but will not allow them to enter anything that is not on the list.
Maybe I didn't understand your problem...
__________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ---Rich Cook
Reply With Quote
  #7  
Old 11-22-2006, 09:00 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

It's a DBCombo, not a regular combobox.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
  #8  
Old 11-22-2006, 09:23 AM
PianoMan's Avatar
PianoMan PianoMan is offline
Contributor
 
Join Date: Oct 2003
Location: NC, USA
Posts: 470
Default

Quote:
Originally Posted by reboot
It's a DBCombo, not a regular combobox.
My apologies. I did understand that. I am familiar with the property in a regular combo box, and MSDN says:
Code:
[b]vbComboDrop-DownList[/b] value - 2 Dropdown List. This style allows selection only from the drop-down list.
Although I did not test it, I thought it should work
__________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ---Rich Cook
Reply With Quote
  #9  
Old 11-22-2006, 09:26 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

I just wanted to point that out. I've never used one and have no idea if they have similar properties or not. If they do, your answer should indeed be correct.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
  #10  
Old 11-23-2006, 01:36 AM
nkechifesie nkechifesie is offline
Regular
 
Join Date: Nov 2006
Posts: 62
Default

Quote:
Originally Posted by PianoMan
My apologies. I did understand that. I am familiar with the property in a regular combo box, and MSDN says:
Code:
[b]vbComboDrop-DownList[/b] value - 2 Dropdown List. This style allows selection only from the drop-down list.
Although I did not test it, I thought it should work
Dont mind me, I still locked the text box before i did what you asked me to. i have unlocked it and did as you bidded and it worked. thank you very much. Sorry about the confusion.
Reply With Quote
  #11  
Old 11-23-2006, 05:47 AM
Keithuk's Avatar
Keithuk Keithuk is offline
Newcomer
 
Join Date: Jun 2005
Location: Staffordshire, England
Posts: 15
Default

It doesn't matter if its a standard ComboBox or a DBCombo you still set the Style to 2 at DesignTime. This will stop the user typing into it.
__________________
I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

http://www.martin2k.co.uk/forums/
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->