-
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
-
Try to change the focus to another control (the textbox you'r writting in) in the form Setfocus event (or Activate event)
-
I tried...
Still not working... could you show me an example, i don't know how to use events... Please, i need help.
-
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.
-
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 :-(
-
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.
-
Try put the Tabstop of the combobox to false.
What you got?
-
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.
-
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
-
This code will give the focus to your combobox:
And to select all:
Code:
Combo2.SelStart = 0
Combo2.SelLength = Len(Combo2.Text)
:oNeed...Rest...Argh...*@!#@&!!!...Ahh...This is not life...
-
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:).
:o Need...coffee...;)
-
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.
-
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).
-
Thanx so much!
Thanx dude, this code worked perfectly, exactly what I watned.
Text1.SelStart = Text1.SelLength
Mikelo