Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOCK BUT ENABLE A CHECK BOX ?!?!

Status
Not open for further replies.

Judai

Programmer
Oct 23, 2002
42
IL
Hello,

I want a check box 2 B visible, that is - not dimmed out, but still 2 keep it locked for changes.
If I enable it, it is exposed 2 changes, if I disable it, it is dim !!!!

Any suggestions guys?

Thanks.
 
Add this to your code


dim fIgnoreInput as boolean

' If the flag is TRUE then whatever is typed the textbox will ingore.
private sub Textbox1.keypress (keyascii as integer)
If fIgnoreInput then keyascii=0
end sub


Have fun ...

ARISTON Engineering Ltd
Michael Vezyrgianopoulos
R&D Manager
 
Just set the CheckBox.Value to what you want in the Click event;

If it is to be always checked:
Code:
Private Sub Check1_Click
Check1.Value = vbChecked
End Sub

If you need to set it in code elsewhere, just set up a Public Long to store it's value and then refer the Click event to that variable.

Public IsChecked as Long
....

Private Sub Check1_Click
Check1.Value = IsChecked
End Sub

Another procedure will set the value:
...
Check1.Value = vbChecked
isChecked = vbChecked

The values available are:
vbChecked
vbUnchecked
vbGrayed Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Sorry I thought that was a TEXT box.
(I've got to clean my contact lenses)
ARISTON Engineering Ltd
Michael Vezyrgianopoulos
R&D Manager
 
Thank U all...

U guys R great.

So, 1 by 1:
Vb5prgrmr: this works rather nice, I found it useful.
vemix: I have a problem with your code, besides the fact that it is 4 a Textbox, the "Textbox1.keypress" (dot) in between the two definitions seems 2 pose a problem, what did U mean?
johnwm: the "10 kinds of sexes U were talkin about...", well, the can all B undone from their first state, HOW DO I USE THE GREYED STATE BUT STILL PREVENT THE USER FROM CHANGING IT'S CURRENT STATE? THE FRAME IDEA FROM Vb5prgrmr seems 2 work quite well...!?!
vemix: no harm done, thanks anyways...


THANK U ALL 4 YOUR TIME & HELP...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top