[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using KeyPress event without invoking Click event at ComboBox control

Posted on 1998-05-06
3
Medium Priority
?
356 Views
Last Modified: 2008-03-04
This is on VB4.0 (32-bit) enterprise version

I was wondering if there is a way that I can get the keypress event from the combobox control (with the setting of 2 ie dropdown list). say for example, inside my combobox has a few items :-
Add
Last
New
Next
Pass
Previous
Stop

when I click on the combobox, it would dropdown and show me this items, so instead of just using click event where after I click on an item using the mouse, eg "First", it would do some process in the click event, I wish to use the keypress event as well, however the process of doing something only starts when I have decided that this is the item I wish to select.
Eg. click on combobox, dropdown list with the items.
Keypress "n", it should highlight "New" item first, since this is not the one that I want to select (no process should
start), I will keypress "n" again, and this time it will highlight on "Next" item, and since this is the one that
I wish to select, the process job starts now.

of course, I wish to have the click event there as well, incase I decide to use the mouse to choose the item.

any help will grateful.
0
Comment
Question by:wsm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 200 total points
ID: 1442006
wsm,

Yes there is a way by using a flag, check the following example.

Example
=======

Dim Key_Press As Boolean

Private Sub Combo1_Click()
 If Not Key_Press Then
  'Do the process now.
  MsgBox Combo1.Text
 End If
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
 If KeyAscii = 13 Then
  Key_Press = False
  Combo1_Click
 Else
  Key_Press = True
 End If
End Sub


Best regards
Bin Huwairib
0
 

Author Comment

by:wsm
ID: 1442007
wsm,

Why don't you use "Microsoft Forms 2.0 Object Libaray" (FM20.DLL)?


Bin Huwairib
0
 
LVL 5

Expert Comment

by:bin_huwairib
ID: 1442008
This is even worst.. I change the normal combobox (from windows common controls active x - comctl32.ocx) to microsoft forms 2.0 object library.

when I click on the combobox (of fm20.dll) it causes invalid page fault with fm20.dll

isn't there a way that I can manipulate the comctl32.ocx's combobox without changing it to fm20.dll's combobox.

I am not sure, if it is because fm20.dll may not very stable in vb4.0 (32-bit)?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question