Stop User Selecting Textbox

G

Guest

Hi. This is probably a simple question needing a one-liner response.

I have textboxes on a form which just display a count of the record. How do
you stop the user being able to click on this textbox? I've disabled tab
stop but user can still click on the field.

TIA once again
rich
 
G

Guest

Set the Enabled property to False or you could put this in the On got Focus
event

SomeOtherControl.SetFocus
 
G

Guest

I know about the "enabled" property... but it greys out the fore colour,
overriding the colour set in the properties. Is there any way of disabling
the textbox but keeping its text shown in blue not grey?
 
G

Guest

Set its locked property to Yes instead. Also use the
SomeOtherControl.SetFocus so that if the user clicks in the box they are
immediately sent to some other box.
 
J

Justin Hoffman

Rich1234 said:
I know about the "enabled" property... but it greys out the fore colour,
overriding the colour set in the properties. Is there any way of
disabling
the textbox but keeping its text shown in blue not grey?


You could set the locked property to true and the enabled to false to make
it look like a regular textbox. But this might be irritating for the user
if it looks the same, but cannot be selected.
 
G

Guest

Thanks guys. With enabled set to no and locked set to yes, the text isn't
greyed out (this was a surprise because it was greyed when just enabled and
locked were set to no .) I have given the box a transparent
background/borders so it doesn't look like a "box"

rich
 
Joined
Aug 1, 2016
Messages
1
Reaction score
0
Old thread, posting this for my future reference.

I needed to make an entire row of a continuous form do something when double clicked without selecting any of the textboxes. In the end, I placed a transparent button with no label on top of the entire row and set the on double click event to do whatever was needed to do. With no event, the button will just do nothing and nothing behind it will be selected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top