[RESOLVED] how to keep components readonly?
how can i make my...
- text box
- list box
- date picker
- combo box
read-only? i know the .enabled = false; property but it turns the forecolor to gray which i dont want.
i want the color to stay as black (normal) but the user should not be able to ammend it until he clicks the edit button.
PS: I am willing to do this for the navigation of records (move first, move next, move previous, move last).
hope i made my self clear.
thanks.
Re: how to keep components readonly?
Textbox - set the locked property to true
Listbox - don't really need to do anything as nothing can be added to it without code
Date Picker - same thing
Combo box - set the locked property to true
Re: how to keep components readonly?
Private Sub txt_name_GotFocus()
cmd_close.SetFocus
End Sub
this works actually what i want to do; but this is lame if i do this for all fields and components.
Re: how to keep components readonly?
Quote:
Originally Posted by Hack
Textbox - set the locked property to true
Listbox - don't really need to do anything as nothing can be added to it without code
Date Picker - same thing
Combo box - set the locked property to true
i dont even want the text to be highlighted :S i tried using locked property before but it still highlights the text.
Re: how to keep components readonly?
Then you will need to write code for each and every text box etc on your form.
Do you want to go that route?
Re: how to keep components readonly?
if you want to stop the contents of highlighting, set the enabled property to False. I think that since DISABLED state is let's say Windows default you may have to let it go. I had a similar problem, and unless you have all the time in the word to code each field separately and to debug it afterwards: get on with the forecolor :P
Re: how to keep components readonly?
Quote:
Originally Posted by tatkosmurff
if you want to stop the contents of highlighting, set the enabled property to False.
He doesn't want to do that.
Typically, I when I need something like this, I will put the code in each individual textbox. It is more effort on my part, but the users (and they are the ones that count) like it.
Re: how to keep components readonly?
It doesn't worth the effort if you ask me. It is good to follow the user's wishes, but this may lead you to a terrible chaos.
Right now I am stuck alone in an enormous ERP-like project because I tried to ensure that all user wishes will be completed. DO NOT MAKE MY MISTAKE.
User must be tolerated to optimize the application GUI, maybe the application performance, but it must be clear for "IT" that is you who takes the decisions.
1 Attachment(s)
Re: how to keep components readonly?
Why have a textbox that's Read Only? If you want something that's read-only, then use a label instead of a textbox.
You can make the label look just like a textbox with borders, colors, and so on.
The only difference in your code then is: Label1.Caption = "something" instead of Textbox1.Text = "something".
If you want the user to be able to change it after clicking the edit button, then you could to something like this:
Make a regular textbox. Then create a label directly on top of the textbox, exactly the same size and look. Have your program write to both the label and the textbox. Have the textbox visible property set to false, and the label visible property set to true.
When the user clicks the edit button, have the label visible property go to false, and the textbox property go to true.
This will do what you want.
Edited: Add attachment: Form
Re: how to keep components readonly?
ummmm so many ways to go still moral of the solution code code & code :p
thanks everyone.
Re: how to keep components readonly?
Quote:
Originally Posted by tatkosmurff
It doesn't worth the effort if you ask me.
It is worth the effort if that is what is on the spec sheet that finds its way into your In-box. :D
Re: [RESOLVED] how to keep components readonly?
yes you are right about that
EOF :)