By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Regarding ComboBox of VB6.0

akashazad
P: 38
Hi Friends,
Question:- In my VB6.0 Form I have used a ComboBox and a ToolBar in which I have provided some buttons such as Add,Modify,Abort,Delete,Save,Print,Exit. and also provided shortcuts to these buttons such as Ctrl+A for Add,Ctrl+M for Modify ,Ctrl+B for Abort.Now the problem is when I Load the Form it is in Find Mode and the focus is on the ComboBox .Now to Add new entry I need to go to Add Mode which can be done in two ways .

1. By Clicking on to Add Button using a Mouse .
2. By pressing the Shortcut key(.i.e Ctrl+A)


Now when I do it using a Mouse the ListIndex of the ComboBox remains the same as it was in Find mode.

But when I use Shortcut to go to Add mode the ListIndex of ComboBox changes to the value whose text starts from A .(Similar thing is happening when I press Ctrl+M to enter Modify Mode i.e. the listindex of combobox changes to the value whose text starts from M)This should not happen list index should remain the same as it was in Find Mode.


For further information I havn't written any thing in KeyDown or KeyPress events of the ComboBox. and the code for these shortcuts is written in KeyDown event of Form.
Jan 28 '08 #1
Share this Question
Share on Google+
6 Replies


lotus18
100+
P: 866
Hi

Post your codes for the reference of our experts. : )

Rey Sean
Jan 28 '08 #2

debasisdas
Expert 5K+
P: 8,127
May i know what exactly is the problem with the application and what you want to achieve .
Jan 28 '08 #3

Expert 5K+
P: 8,434
A couple of questions.

First, could you use different shortcut keys? Some of those are already significant. For instance, if you're in a text field (including the text part of a combo box) then Ctrl-A would do a "select all".

Second, do you have the form's KeyPreview function set to True, so it gets to see the keys first?

Third, in the KeyDown event procedure, are you cancelling the key after processing it?

Fourth, to be honest, I have no idea what you mean by "Find mode".
Jan 29 '08 #4

akashazad
P: 38
A couple of questions.

First, could you use different shortcut keys? Some of those are already significant. For instance, if you're in a text field (including the text part of a combo box) then Ctrl-A would do a "select all".

Second, do you have the form's KeyPreview function set to True, so it gets to see the keys first?

Third, in the KeyDown event procedure, are you cancelling the key after processing it?

Fourth, to be honest, I have no idea what you mean by "Find mode".
Hi THANKS for responding and Sorry for not being clear in asking the Question.

1. I can not use any other Shortcut key.

2. I have set the keypreview property to true

3. I dont know what do U mean by Cancelling of key in keydown event

4. Find mode is similar to Browse mode in which we can go through the record but can not make any change and to make any change i.e. to Add or to Modify any record U need to move to Add Mode or Modify Mode respectively (so that Controls on the Forms become editable which is not in case of Find Mode).I think now U will be able to understand What I mean by Find mode
Jan 29 '08 #5

akashazad
P: 38
A couple of questions.

First, could you use different shortcut keys? Some of those are already significant. For instance, if you're in a text field (including the text part of a combo box) then Ctrl-A would do a "select all".

Second, do you have the form's KeyPreview function set to True, so it gets to see the keys first?

Third, in the KeyDown event procedure, are you cancelling the key after processing it?

Fourth, to be honest, I have no idea what you mean by "Find mode".
Hi THANKS for responding and Sorry for not being clear in asking the Question.

1. I can not use any other Shortcut key.

2. I have set the keypreview property to true

3. I dont know what do U mean by Cancelling of key in keydown event

4. Find mode is similar to Browse mode in which we can go through the record but can not make any change and to make any change i.e. to Add or to Modify any record U need to move to Add Mode or Modify Mode respectively (so that Controls on the Forms become editable which is not in case of Find Mode).I think now U will be able to understand What I mean by Find mode
Jan 29 '08 #6

Expert 5K+
P: 8,434
Thanks, that explains a bit more.

In the KeyDown event, you get to see what key was pressed, before anything much is done with it. At that point, I believe if you clear the value of KeyCode, it will effectively "abort" the keypress. I mean, any further code (such as a control's Keypress event procedure) won't be notified of the action.

This may (not certain) prevent the problem of with the combobox moving to the "A" entry.

Try it, anyway, and see what happens.
Jan 29 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.