Stop User Selecting Textbox

R

Rich1234

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
 
D

Dennis

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

SomeOtherControl.SetFocus
 
R

Rich1234

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?
 
D

Dennis

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.
 
R

Rich1234

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
 
Top