PC Review


Reply
Thread Tools Rate Thread

?disable txtbox without graying out font?

 
 
Rich
Guest
Posts: n/a
 
      26th Feb 2004
Hello,

So I would like to disable a textbox on a vb.net form
without the text getting grayed out. In vb6 I could place
a textbox control on a frame control and disable the frame
leaving the textbox enabled and text/background were
intact but mouse cursor remained an arraw (as opposed to
an I for editable). I tried a Panel control on my .net
form since I could I guess there is no longer a frame
control (also tried a groupbox control). I disable these
container controls, but in the panel the textbox got
grayed out. With groupbox, the textbox was still
editable. Any suggestions appreciated how to disable
textbox without graying it out.

Thanks,
Rich
 
Reply With Quote
 
 
 
 
Rich
Guest
Posts: n/a
 
      26th Feb 2004
I just had a thought. A lable with a 3d border kinda
looks like a textbox. Is this the way .net does it now?
Just checking.

>-----Original Message-----
>Hello,
>
>So I would like to disable a textbox on a vb.net form
>without the text getting grayed out. In vb6 I could

place
>a textbox control on a frame control and disable the

frame
>leaving the textbox enabled and text/background were
>intact but mouse cursor remained an arraw (as opposed to
>an I for editable). I tried a Panel control on my .net
>form since I could I guess there is no longer a frame
>control (also tried a groupbox control). I disable these
>container controls, but in the panel the textbox got
>grayed out. With groupbox, the textbox was still
>editable. Any suggestions appreciated how to disable
>textbox without graying it out.
>
>Thanks,
>Rich
>.
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      26th Feb 2004
In VB 6.0, all you needed to do what changed the locked property to true
(not the enabled property, which caused the text to gray out).

In .NET, you just change the ReadOnly property to true.


"Rich" <(E-Mail Removed)> wrote in message
news:264801c3fc85$c7fc8190$(E-Mail Removed)...
> Hello,
>
> So I would like to disable a textbox on a vb.net form
> without the text getting grayed out. In vb6 I could place
> a textbox control on a frame control and disable the frame
> leaving the textbox enabled and text/background were
> intact but mouse cursor remained an arraw (as opposed to
> an I for editable). I tried a Panel control on my .net
> form since I could I guess there is no longer a frame
> control (also tried a groupbox control). I disable these
> container controls, but in the panel the textbox got
> grayed out. With groupbox, the textbox was still
> editable. Any suggestions appreciated how to disable
> textbox without graying it out.
>
> Thanks,
> Rich



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      26th Feb 2004
* "Rich" <(E-Mail Removed)> scripsit:
> So I would like to disable a textbox on a vb.net form
> without the text getting grayed out. In vb6 I could place
> a textbox control on a frame control and disable the frame
> leaving the textbox enabled and text/background were
> intact but mouse cursor remained an arraw (as opposed to
> an I for editable). I tried a Panel control on my .net
> form since I could I guess there is no longer a frame
> control (also tried a groupbox control). I disable these
> container controls, but in the panel the textbox got
> grayed out. With groupbox, the textbox was still
> editable. Any suggestions appreciated how to disable
> textbox without graying it out.


Set the textbox's 'ReadOnly' property to 'True' and reset the backcolor.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>
 
Reply With Quote
 
Rich
Guest
Posts: n/a
 
      26th Feb 2004
Thank you all for your replies. I did check out the lable
with 3d border. That kinda looks like a textbox.

My goal is to disable the textbox control such that when
you pass your mouse over the control the pointer does not
change from an arrow to an I. Readonly still lets the
mousepointer change to an I. The closest thing I have
found so far is to use a rich textbox disabled with a
label inside. The only hassel here is setting the size of
the rich textbox and label to make it look like a regular
textbox.


>-----Original Message-----
>Hello,
>
>So I would like to disable a textbox on a vb.net form
>without the text getting grayed out. In vb6 I could

place
>a textbox control on a frame control and disable the

frame
>leaving the textbox enabled and text/background were
>intact but mouse cursor remained an arraw (as opposed to
>an I for editable). I tried a Panel control on my .net
>form since I could I guess there is no longer a frame
>control (also tried a groupbox control). I disable these
>container controls, but in the panel the textbox got
>grayed out. With groupbox, the textbox was still
>editable. Any suggestions appreciated how to disable
>textbox without graying it out.
>
>Thanks,
>Rich
>.
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      26th Feb 2004
Use this in conjunction with setting the ReadOnly property to true:

attributes.add("style","cursor:normal")



"Rich" <(E-Mail Removed)> wrote in message
news:28f301c3fc8c$ec7d9520$(E-Mail Removed)...
> Thank you all for your replies. I did check out the lable
> with 3d border. That kinda looks like a textbox.
>
> My goal is to disable the textbox control such that when
> you pass your mouse over the control the pointer does not
> change from an arrow to an I. Readonly still lets the
> mousepointer change to an I. The closest thing I have
> found so far is to use a rich textbox disabled with a
> label inside. The only hassel here is setting the size of
> the rich textbox and label to make it look like a regular
> textbox.
>
>
> >-----Original Message-----
> >Hello,
> >
> >So I would like to disable a textbox on a vb.net form
> >without the text getting grayed out. In vb6 I could

> place
> >a textbox control on a frame control and disable the

> frame
> >leaving the textbox enabled and text/background were
> >intact but mouse cursor remained an arraw (as opposed to
> >an I for editable). I tried a Panel control on my .net
> >form since I could I guess there is no longer a frame
> >control (also tried a groupbox control). I disable these
> >container controls, but in the panel the textbox got
> >grayed out. With groupbox, the textbox was still
> >editable. Any suggestions appreciated how to disable
> >textbox without graying it out.
> >
> >Thanks,
> >Rich
> >.
> >



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      26th Feb 2004
Setting a TextBox to disabled grays out the text color, not the background
color. Attempts to change the text color back to black are ignored.

See my other post for the textbox solution.


"George L." <(E-Mail Removed)> wrote in message
news:OMsmkkI$(E-Mail Removed)...
>
> ? "Rich" <(E-Mail Removed)> ?????? ??? ??????
> news:264801c3fc85$c7fc8190$(E-Mail Removed)...
> > Hello,
> >
> > So I would like to disable a textbox on a vb.net form
> > without the text getting grayed out. In vb6 I could place
> > a textbox control on a frame control and disable the frame
> > leaving the textbox enabled and text/background were
> > intact but mouse cursor remained an arraw (as opposed to
> > an I for editable). I tried a Panel control on my .net
> > form since I could I guess there is no longer a frame
> > control (also tried a groupbox control). I disable these
> > container controls, but in the panel the textbox got
> > grayed out. With groupbox, the textbox was still
> > editable. Any suggestions appreciated how to disable
> > textbox without graying it out.
> >
> > Thanks,
> > Rich

>
> Hi Rich!
> After you set the 'enabled' property of the textbox to false
> you can change the backcolor to web->white. You can always use a simple
> label with white backcolor & Fixed3D BorderStyle.
>
>



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      26th Feb 2004
Why would the backcolor need to be reset? Setting to ReadOnly to true does
not change any of the colors.


"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:c1l9gt$1jpefs$(E-Mail Removed)...
> * "Rich" <(E-Mail Removed)> scripsit:
> > So I would like to disable a textbox on a vb.net form
> > without the text getting grayed out. In vb6 I could place
> > a textbox control on a frame control and disable the frame
> > leaving the textbox enabled and text/background were
> > intact but mouse cursor remained an arraw (as opposed to
> > an I for editable). I tried a Panel control on my .net
> > form since I could I guess there is no longer a frame
> > control (also tried a groupbox control). I disable these
> > container controls, but in the panel the textbox got
> > grayed out. With groupbox, the textbox was still
> > editable. Any suggestions appreciated how to disable
> > textbox without graying it out.

>
> Set the textbox's 'ReadOnly' property to 'True' and reset the backcolor.
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      26th Feb 2004
* "Scott M." <s-(E-Mail Removed)> scripsit:
> Why would the backcolor need to be reset? Setting to ReadOnly to true does
> not change any of the colors.


It changes the backcolor to control color on .NET 1.1, Windows XP
Professional, so I have to reset it.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>
 
Reply With Quote
 
Rich
Guest
Posts: n/a
 
      26th Feb 2004
Thanks for this suggestion. May I ask how you implement
this? I looked around the help files for attributes,
cursor but have not found a way to implement your
suggestion (although, it sound pretty cool). Here is what
I tried:

txt1.attributes... obviously did not work
txt1.ReadOnly(attributes...)=false

Thanks for your suggestion though.


>-----Original Message-----
>Use this in conjunction with setting the ReadOnly

property to true:
>
>attributes.add("style","cursor:normal")
>
>
>
>"Rich" <(E-Mail Removed)> wrote in

message
>news:28f301c3fc8c$ec7d9520$(E-Mail Removed)...
>> Thank you all for your replies. I did check out the

lable
>> with 3d border. That kinda looks like a textbox.
>>
>> My goal is to disable the textbox control such that when
>> you pass your mouse over the control the pointer does

not
>> change from an arrow to an I. Readonly still lets the
>> mousepointer change to an I. The closest thing I have
>> found so far is to use a rich textbox disabled with a
>> label inside. The only hassel here is setting the size

of
>> the rich textbox and label to make it look like a

regular
>> textbox.
>>
>>
>> >-----Original Message-----
>> >Hello,
>> >
>> >So I would like to disable a textbox on a vb.net form
>> >without the text getting grayed out. In vb6 I could

>> place
>> >a textbox control on a frame control and disable the

>> frame
>> >leaving the textbox enabled and text/background were
>> >intact but mouse cursor remained an arraw (as opposed

to
>> >an I for editable). I tried a Panel control on my .net
>> >form since I could I guess there is no longer a frame
>> >control (also tried a groupbox control). I disable

these
>> >container controls, but in the panel the textbox got
>> >grayed out. With groupbox, the textbox was still
>> >editable. Any suggestions appreciated how to disable
>> >textbox without graying it out.
>> >
>> >Thanks,
>> >Rich
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charts graying out Mickey Microsoft Excel Charting 2 5th Jun 2006 09:50 PM
Disable SIP popup when selecting TxtBox. J.W.Schulze Microsoft Dot NET Compact Framework 0 13th Jan 2004 04:22 PM
Disable Font Style and Size selection in Font Dialio box Microsoft C# .NET 1 28th Nov 2003 01:39 PM
Graying of images & colors mave Windows XP Internet Explorer 2 20th Nov 2003 09:53 PM
Graying Out Some Rows Tamer Seoud Microsoft Excel Programming 5 19th Nov 2003 09:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:15 PM.