Results 1 to 14 of 14

Thread: Important... Anyone know?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137

    Angry

    Forgive my many questions, but I am not very introduced into the windows command such as SetPosWindow and stuff like that, i would like to learn how. But anyways. Here is my question:

    If my app gets unselected and then reselected, my combo box always gets selected, and if i am typing really fast andmy app gets de selected and reselected my combo box contents get highlighted/selected and the next key i press overrides it all and it gets ereased.What i wanna do is for it not to select it. Any ideas?

    Thanx,
    Mikelo

  2. #2
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85
    Try to change the focus to another control (the textbox you'r writting in) in the form Setfocus event (or Activate event)
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137

    Unhappy I tried...

    Still not working... could you show me an example, i don't know how to use events... Please, i need help.

  4. #4
    Guest
    Code:
    Private Sub Form_Activate()
       Text1.SetFocus
    End Sub
    OR, you could set the TabOrder of the control to a big valus like 5000000000. Don't worry if it changes, but if it doesn't, set it even bigger.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137

    Unhappy Thanx..

    BUt I am looking for a code that works on a COmboBox
    It works on da textbox but not on combo. Thanx anyways:-)

    BTW. Combo1.Setfocus don't work :-(

  6. #6
    Guest
    Actually, it will work on most controls. Look througt a control's properties and see if it has a "SetFocus" method. If it does, than you can use that control in place of Text1.

    This code just transfers the focus to a textbox so that you won't have to worry about it going into the combo again.

  7. #7
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Exclamation

    Try put the Tabstop of the combobox to false.

    What you got?
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137

    Wink Not Quite.

    This worked for one thing, but to type again i must always select the box again.

    This is what i want and what happens:
    1.Form get's Deselected all the time, so it gets re-activated
    2.When it gets re activated the combo box selects it self and the next key i press erases it all. so it'll be like this: I am writing" http://ww" (De&Re Select) and then "w." is all that it'll say.


  9. #9
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Post

    If you means that you are typing within the combo I think this is what you need:

    Private Sub Combo1_GotFocus()
    Combo1.SelStart = Combo1.SelLength
    End Sub
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  10. #10
    Guest
    This code will give the focus to your combobox:

    Code:
        Combo4000.SetFocus
    And to select all:

    Code:
        Combo2.SelStart = 0
        Combo2.SelLength = Len(Combo2.Text)
    Need...Rest...Argh...*@!#@&!!!...Ahh...This is not life...

  11. #11
    Guest
    Feras, no!!!



    Code:
    Combo1.SelStart = Len(Combo1.Text)
    Combo1.SelLength = 0
    Feras, your code would turn the caret in the front or, for example:

    Legend:
    |...| = Selection

    Let's say:
    Combo |Box Text| Obvious

    Would become:

    Combo Bo|x Text O|bivous.

    Don't use that, and you also need more logic. I'm serious.

    Need...coffee...

  12. #12
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Lightbulb

    According to his problem my code is right that is becose when the combobox got focus the whole text will be selected.

    Any way for general we can replace that code by this:

    Private Sub Combo1_GotFocus()
    Combo1.SelStart = Len(Combo1.Text)
    End Sub

    But I still insists that the previous was right.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  13. #13
    Guest
    Yes, but if he's a TRUE beginner, he might use it in anmother way (and even if not, somebody who views the forums may).

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137

    Talking Thanx so much!

    Thanx dude, this code worked perfectly, exactly what I watned.

    Text1.SelStart = Text1.SelLength

    Mikelo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width