|
-
Jan 23rd, 2008, 12:00 PM
#1
Thread Starter
Member
Simulating a disabled textbox
It's incredible. As soon as I get out of a problem (thanks to members of this forum many times), I get into another.
Now, I need to disable a multiline textbox, so no one could edit or even click on the textbox (of course they could click, but it wouldn't have any effect)
My first option was to use the enabled property, but the problem is that if I do that, I can't change the font color, so it looks kind of wierd. I need the color to be black, but I don't know hoy can I change it.
Does anyone know hoy to solve this problem?
Thanks in advance.
-
Jan 23rd, 2008, 12:02 PM
#2
Fanatic Member
Re: Simulating a disabled textbox
There is a ReadOnly property on a textbox that stops people from editing it.
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
-
Jan 23rd, 2008, 12:04 PM
#3
Re: Simulating a disabled textbox
Also, a Label with AutoSize set to False, BorderStyle set to Fixed3D and BackColor set to White "kind of" looks like a textbox.
-
Jan 23rd, 2008, 12:31 PM
#4
Thread Starter
Member
Re: Simulating a disabled textbox
Wow!! Those were really quick answers...
I think that I haven't explain the problem as good as I should. I didn't want to be boring with the first post, so I didn't tell the whole story.
Now, that I see that your answers are perfect answers for what I asked, I'm going to explain more my situation so you can understand all the facts that affect my problem.
I have made my own user control. It's made up of a multiline textbox (without scrollbar), and a customized scrollbar.
The text that it's going to be in the textbox can't be edit (as we have said before), but the problem is that I don't want the user to use the keyword to go through the text, because I don't know how to synchronize his movements with the scrollbar. So I need that the user cannot set the "text cursor" (I don't know if this is a correct term).
I think that's all
So, now, reading your answers (I repeat that they were correct because I didn't explain it correctly) I see several problems.
 Originally Posted by dminder
There is a ReadOnly property on a textbox that stops people from editing it.
Yes, I know this property, but although it disable to edit the post, it allows the user to set the "text cursor".
I size the oportunity to ask: How can I edit a Readonly property? (sorry for my ignorance)
 Originally Posted by Atheist
Also, a Label with AutoSize set to False, BorderStyle set to Fixed3D and BackColor set to White "kind of" looks like a textbox. 
The problem with the label is that the text is multiline, so it looks a little bit difficult to use it. But... if there isn't another option, I think that this is a good solution. I think that I can paint with GDI all the text in a bufferimage, and then move it up and down so it would only appear on the label region....isn't it?
Since I don't speak english very well and obviously I'm far from being a Visual Basic Master , I dont' know if all the things that I have written are only stupidities.
I promise that I have tried to do it my best.
Thanks in advance for your answers.
Last edited by sagoga69; Jan 23rd, 2008 at 12:37 PM.
-
Jan 23rd, 2008, 12:39 PM
#5
Fanatic Member
-
Jan 23rd, 2008, 12:41 PM
#6
Thread Starter
Member
Re: Simulating a disabled textbox
Sure....I think it will work using that method.
Thanks a lot dminder
PS: Tomorrow I'll tell you
-
Jan 23rd, 2008, 12:43 PM
#7
Re: Simulating a disabled textbox
You should choose the Enter event rather than the GotFocus event.
MSDN:
The GotFocus and LostFocus events are low-level focus events that are tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically, the GotFocus and LostFocus events are only used when updating UICues or when writing custom controls. Instead the Enter and Leave events should be used for all controls except the Form class, which uses the Activated and Deactivate events.
-
Jan 23rd, 2008, 01:01 PM
#8
Thread Starter
Member
Re: Simulating a disabled textbox
Ok!! I'll do it tomorrow. Thanks again, Atheist
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|