RuschWEB
asked on
ComboBox Issue
I want a ComboBox that is (*.)Locked but I still want entries to be selectable. In other words, I want entries in the pop-down list to be selectable, but I don't want the user to be able to enter anything manually. Is there a property that I'm missing, or is there any other way around this?
ASKER
but then i can't put anything into myself even..
e.g.
MenuForm.TimeSlotChoice.Te xt = WordsLang(1)
..would not work. :\ because style 2 gives the combobox a read-only attribute.. :\ which i can't have.. is there a way i can change the style temporarily throughout the program?
i.e.
MenuForm.TimeSlotChoice.St yle = 0
MenuForm.TimeSlotChoice.Te xt = WordsLang(1)
MenuForm.TimeSlotChoice.St yle = 2
..or something like that?
e.g.
MenuForm.TimeSlotChoice.Te
..would not work. :\ because style 2 gives the combobox a read-only attribute.. :\ which i can't have.. is there a way i can change the style temporarily throughout the program?
i.e.
MenuForm.TimeSlotChoice.St
MenuForm.TimeSlotChoice.Te
MenuForm.TimeSlotChoice.St
..or something like that?
You can add it with code
TimeSlotChoice.additem wordslang(1)
TimeSlotChoice.additem wordslang(1)
ASKER
But I don't want to add it to the list as an Item, i just want the Caption of it to become WordsLang(1) in this case.
Know I can't follow any more....
You don't want the user to give the ability to enter data in the combobox. That's done by putting the liststyle to 2
You don't want to add something to the list. Is it the purpose to set the list automatically to the text you give (in this case wordslang(1), beacause that word is already in the list)... if that's what you mean then you have to do
TimeSlotChoice.listindex = 0
while timeslotchoice.listindex < timeslotchoice.listcount -1and timeslotchoice.list <> wordslang(1) then
timeslotchoice.listindex = timeslotchoice.listindex + 1
wend
If that isn't the meaning, try to explain it better.
You don't want the user to give the ability to enter data in the combobox. That's done by putting the liststyle to 2
You don't want to add something to the list. Is it the purpose to set the list automatically to the text you give (in this case wordslang(1), beacause that word is already in the list)... if that's what you mean then you have to do
TimeSlotChoice.listindex = 0
while timeslotchoice.listindex < timeslotchoice.listcount -1and timeslotchoice.list <> wordslang(1) then
timeslotchoice.listindex = timeslotchoice.listindex + 1
wend
If that isn't the meaning, try to explain it better.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, sridhar12345 - thank you very much for your help. That solved my problem.
Private Sub TimeSlotChoice_KeyPress(Ke yAscii As Integer)
KeyAscii = 0
End Sub
May you live long and prosperous.. :P
Private Sub TimeSlotChoice_KeyPress(Ke
KeyAscii = 0
End Sub
May you live long and prosperous.. :P
ASKER
Well, before I loose my last points I just wanna ask..
I have an error handler that looks like this..
On Error GoTo ErrorHandler
ErrorHandler:
Select Case Err
Case 7 'out of memory
tmp = MsgBox(WordsLang(80), vbCritical, WordsLang(85))
Resume
Case 61 'harddisk full
tmp = MsgBox(WordsLang(81), vbCritical, WordsLang(85))
Close All
End
Case 71 'disk not ready
tmp = MsgBox(WordsLang(82), vbCritical, WordsLang(85))
Resume
Case 72 'disk damaged
tmp = MsgBox(WordsLang(83), vbCritical, WordsLang(85))
Resume
Case 75 'path/file access error
tmp = MsgBox(WordsLang(84), vbCritical, WordsLang(85))
Close All
End
Else
tmp = MsgBox(WordsLang(87), vbCritical, WordsLang(85))
Close All
End
End Select
Where do I put the label, and where do I put the 'On Error' statement? In a sub somewhere?
I have an error handler that looks like this..
On Error GoTo ErrorHandler
ErrorHandler:
Select Case Err
Case 7 'out of memory
tmp = MsgBox(WordsLang(80), vbCritical, WordsLang(85))
Resume
Case 61 'harddisk full
tmp = MsgBox(WordsLang(81), vbCritical, WordsLang(85))
Close All
End
Case 71 'disk not ready
tmp = MsgBox(WordsLang(82), vbCritical, WordsLang(85))
Resume
Case 72 'disk damaged
tmp = MsgBox(WordsLang(83), vbCritical, WordsLang(85))
Resume
Case 75 'path/file access error
tmp = MsgBox(WordsLang(84), vbCritical, WordsLang(85))
Close All
End
Else
tmp = MsgBox(WordsLang(87), vbCritical, WordsLang(85))
Close All
End
End Select
Where do I put the label, and where do I put the 'On Error' statement? In a sub somewhere?
on error: under your private/public sub declaration
errorhandler: just above end sub
Private Sub TimeSlotChoice_KeyPress(Ke yAscii As Integer)
On Error GoTo ErrorHandler
KeyAscii = 0
exit sub
ErrorHandler:
Select Case Err
Case 7 'out of memory
tmp = MsgBox(WordsLang(80), vbCritical, WordsLang(85))
Resume
Case 61 'harddisk full
tmp = MsgBox(WordsLang(81), vbCritical, WordsLang(85))
Close All
End
Case 71 'disk not ready
tmp = MsgBox(WordsLang(82), vbCritical, WordsLang(85))
Resume
Case 72 'disk damaged
tmp = MsgBox(WordsLang(83), vbCritical, WordsLang(85))
Resume
Case 75 'path/file access error
tmp = MsgBox(WordsLang(84), vbCritical, WordsLang(85))
Close All
End
Else
tmp = MsgBox(WordsLang(87), vbCritical, WordsLang(85))
Close All
End
End Select
End Sub
errorhandler: just above end sub
Private Sub TimeSlotChoice_KeyPress(Ke
On Error GoTo ErrorHandler
KeyAscii = 0
exit sub
ErrorHandler:
Select Case Err
Case 7 'out of memory
tmp = MsgBox(WordsLang(80), vbCritical, WordsLang(85))
Resume
Case 61 'harddisk full
tmp = MsgBox(WordsLang(81), vbCritical, WordsLang(85))
Close All
End
Case 71 'disk not ready
tmp = MsgBox(WordsLang(82), vbCritical, WordsLang(85))
Resume
Case 72 'disk damaged
tmp = MsgBox(WordsLang(83), vbCritical, WordsLang(85))
Resume
Case 75 'path/file access error
tmp = MsgBox(WordsLang(84), vbCritical, WordsLang(85))
Close All
End
Else
tmp = MsgBox(WordsLang(87), vbCritical, WordsLang(85))
Close All
End
End Select
End Sub
ASKER
but if i do that, wont it run the "case else" part when i change something in Private Sub TimeSlotChoice_KeyPress(Ke yAscii As Integer)?
No, as long as there is no error, your error handler won't start
The user can choose a possibility, but can't enter data in combobox