PDA

View Full Version : Solved: Disable focus Textbox.



hobgoblin
08-12-2005, 10:57 AM
My question is simple. And here it is : Does anyone knows how do i disable the focus of a textbox. Like setfocus = false in a normal vb6. Unfortunately it doesn't work in PowerPoint.

Thanks.

MOS MASTER
08-12-2005, 03:54 PM
My question is simple. And here it is : Does anyone knows how do i disable the focus of a textbox. Like setfocus = false in a normal vb6. Unfortunately it doesn't work in PowerPoint.

Thanks.

Hi and Welcome to VBAX! :hi:

Don't think I've ever found use to do a thing like that so I'm curious.

Could explain what you are trying to do in more detail? Why is setting focus false so Important...what don't you want to happen? :whistle:

hobgoblin
08-15-2005, 06:08 AM
Ok. What I am doing is using the KeyUp (When i press enter) event of a textbox to get data. But if i have an error i show up a message box. And when user presses enter ( OK button of message box ) and the focus is on the textbox, VB catches it as an ENTER key press of the textbox as well. So it tries to get data again, and again, and again.... I tried to put enabled false, locked true etc on the textbox, but the texbox still catches the ENTER key press. And since i don't have any other textbox's I cant just shift focus out of it. That's about it. Any help would be very appreciated.

Killian
08-15-2005, 06:25 AM
Have you considered using the Exit event of the textbox for the validation?

hobgoblin
08-15-2005, 06:32 AM
Well that's the thing. I dont want to exit the texbox. What i want to do is to just temporarily disable it, and when i'm done getting data put the focus back on it.

Killian
08-15-2005, 06:53 AM
I see... well that's most inconvenient
I had a quick test and it seems to behave properly on the KeyDown event

hobgoblin
08-15-2005, 07:21 AM
OK KeyDown it is then :)

Thanks alot for your help.

MOS MASTER
08-15-2005, 12:07 PM
OK KeyDown it is then :)

Thanks alot for your help.

Glad to see K helped you out! :yes

Don't forget to mark to thread solved? :*)