Regarding ComboBox of VB6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akashazad
    New Member
    • Sep 2007
    • 38

    Regarding ComboBox of VB6.0

    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,Abor t,Delete,Save,P rint,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.
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Hi

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

    Rey Sean

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      May i know what exactly is the problem with the application and what you want to achieve .

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        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".

        Comment

        • akashazad
          New Member
          • Sep 2007
          • 38

          #5
          Originally posted by Killer42
          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

          Comment

          • akashazad
            New Member
            • Sep 2007
            • 38

            #6
            Originally posted by Killer42
            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

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              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.

              Comment

              Working...