Selecting Controls

  • Thread starter Thread starter JLW
  • Start date Start date
J

JLW

I'm having a small issue with this, under VB6, it was simple. I have a
combo box and 2 textboxes, tb1 and tb2. Well, when a certian action is
performed, I need to select (activate) tb2, leaving the combobox and tb1
alone. I do data entry appz, and the less mouse reaching and key strokes,
the faster things can go.

Thanks,
JLW
 
JLW said:
I'm having a small issue with this, under VB6, it was simple. I have a
combo box and 2 textboxes, tb1 and tb2.
when a certian action is performed, I need to select (activate) tb2

Depends partially on the "certain action", but

Me.tb2.Focus()

should do the trick.

HTH,
Phill W.
 
Unfortunatly, that did not do the trick. I'm just trying to figure out WTF,
but, let's try it from this aproach. Say you have a button, and when you
click it, in the code, how do you set tb2 active, putting the cursor in it.
I've tried in vein, and it's gotten to the point where it's required I have
this functionality.

Thanks,
JLW
 
I have even tried Me.ActiveControl=tb2 and still no joy. And I threw in an
Application.DoEvents() for good measure....
 
Here's an added twist, if I Mouse Click to another app, then Click back, it
set's the focus to tb2, but not if I use ALT-TAB switching. WTF is going on
here!
 
What The ****, usually. Or Why The **** in this case... :D

(I might not be a good programmer, but I know me swearin' :)) )
________________________
The Grim Reaper
 
Hi JLW,

This does really sets the focus from box1 to box2 try it.

Did you know that Herfried is very young so take care what you say?

I hope this helps?

Cor
\\\
This should really do the trick
Private Sub Button1_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Me.TextBox1.Focus()
End Sub

Private Sub Button2_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
Me.TextBox2.Focus()
End Sub
////
 
I currently have that code in, and I have to leave focus from my form, then
go back for the control focus to change. Weirdest damn thing I've ever seen

Thanks again Cor, and for the Tip,
JLW
 
Apologies... must be getting old... I don't think of programmers as being
young any more!!
Not that I can remember being young - I've been drunk since I was 11...lol
_______________________________
The Grim Reaper
 
Cor,

After looking into the links on Herfried's signature, he seems to be a very
qualified programmer.
Unless the "rules" of getting qualified in your country are really strange,
I don't think Herfried could be of MVP status AND be too young to know the
ins and outs of rude words...
Where did you get the idea Herfried was very young?!?!
____________________________
Grim (The Rude Reaper)
 
Hi Grim Raper,

I know the age of Herfried, you can see it on his site, it was just to
prickle him.
Normaly he react with a kind of agressive message (I know that it is not)
However he seems to be very bussy at the moment.

:-)

Cor
 
Do I have to tell all.
Where did you see my age on my website?

:-)
You are a student my dear Herfried, age is not only a real date.

As I always tell, you have still a lot to learn, however that goes fast.

:-)

Cor
 
That's not a good assesment Cor, because my mother was 54 when she finally
became a student. Besides, judging from Herfried's pic, I'd say he's
between 17 and 21. Also, the whole morality stuff that us americans hold so
dear, europeans see things different. I'm not saying it's better or worse,
just different. For instance, when I was growing up in southern Germany, it
was acceptable for a woman to go topless at a public swimming pool. To us,
it's morally offensive, to them, it's natural.

Just food for thought,
JLW
 
You are right, I know,

However I know his age, but it is not to me to tell what it is.

He is in Europe more than old enough for what you told, as I told, I was
only prickling Herfried, because in past he was sending everytime a message
to this newsgroup when there where messages like yours. "Keep in mind there
are young people as well watching this newsgroup".

By the way, it is in almost in the whole of continental western Europe north
from Italy and Spain normal to swim topless for a woman. (In Spain it is
normal for not Spanish citizens, in Italy not).

Although, it is acceptable for a woman to swim not topless.

:-)

Cor
 
You are too funny Cor, I didn't mean anything by it, just making sure
everyone knew you weren't trying to be an a$$ and that others shouldn't be
one back. Everyone's got their opinions.

Anyhew, I'm going to check on my post in the VC group, hopefully I can
figure this crap out!

JLW
 
Hi JLW,

There was nothing funny in my last message, just as it is, sorry wen I did
give you the wrong idea.

Cor
 
Back
Top