473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

?disable txtbox without graying out font?

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
Nov 20 '05 #1
13 14537
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 placea textbox control on a frame control and disable the frameleaving 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
.

Nov 20 '05 #2
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" <an*******@discussions.microsoft.com> wrote in message
news:26****************************@phx.gbl...
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

Nov 20 '05 #3

? "Rich" <an*******@discussions.microsoft.com> ?????? ??? ??????
news:26****************************@phx.gbl...
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.
Nov 20 '05 #4
* "Rich" <an*******@discussions.microsoft.com> 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/>
Nov 20 '05 #5
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 placea textbox control on a frame control and disable the frameleaving 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
.

Nov 20 '05 #6
Use this in conjunction with setting the ReadOnly property to true:

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

"Rich" <an*******@discussions.microsoft.com> wrote in message
news:28****************************@phx.gbl...
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
.

Nov 20 '05 #7
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." <Ar*******@hotmail.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl...

? "Rich" <an*******@discussions.microsoft.com> ?????? ??? ??????
news:26****************************@phx.gbl...
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.

Nov 20 '05 #8
Why would the backcolor need to be reset? Setting to ReadOnly to true does
not change any of the colors.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Rich" <an*******@discussions.microsoft.com> 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/>

Nov 20 '05 #9
* "Scott M." <s-***@BADSPAMsnet.net> 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/>
Nov 20 '05 #10
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" <an*******@discussions.microsoft.com> wrote in messagenews:28****************************@phx.gbl...
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
>.
>

.

Nov 20 '05 #11
OK. I found this:

txt1.Cursor = System.Windows.Forms.Cursors.Arrow

This works but I can still enter the textbox. My goal is
to be able to disable the textbox without having it gray
out. I'm sure there is a way to do this if it was doable
in VB6.

-----Original Message-----
Use this in conjunction with setting the ReadOnly property to true:
attributes.add("style","cursor:normal")

"Rich" <an*******@discussions.microsoft.com> wrote in messagenews:28****************************@phx.gbl...
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
>.
>

.

Nov 20 '05 #12
Ok, you didn't specify earlier that you were talking about a Windows Forms
app and not an ASP.NET app (2 different textboxes), but anyway just make the
textbox ReadOnly as well as what you have done below and you are all set.
"Rich" <an*******@discussions.microsoft.com> wrote in message
news:29****************************@phx.gbl...
OK. I found this:

txt1.Cursor = System.Windows.Forms.Cursors.Arrow

This works but I can still enter the textbox. My goal is
to be able to disable the textbox without having it gray
out. I'm sure there is a way to do this if it was doable
in VB6.

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

property to true:

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

"Rich" <an*******@discussions.microsoft.com> wrote in

message
news:28****************************@phx.gbl...
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
>.
>

.

Nov 20 '05 #13
This works for me:

TextBox1.Cursor = System.Windows.Forms.Cursors.Arrow

TextBox1.ReadOnly = True

TextBox1.BackColor = Color.White

"Rich" <an*******@discussions.microsoft.com> wrote in message
news:29****************************@phx.gbl...
OK. I found this:

txt1.Cursor = System.Windows.Forms.Cursors.Arrow

This works but I can still enter the textbox. My goal is
to be able to disable the textbox without having it gray
out. I'm sure there is a way to do this if it was doable
in VB6.

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

property to true:

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

"Rich" <an*******@discussions.microsoft.com> wrote in

message
news:28****************************@phx.gbl...
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
>.
>

.

Nov 20 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field...
2
by: HolaGoogle | last post by:
Can you please tell me the right way to do this?? it's realy important! thanks in advance... Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have...
0
by: Paul T. Rong | last post by:
There is a txtbox (time) in a switchboard, I would like to make the time txtbox visible all the time (some big forms block off the time txtbox). Thanks in advance. Paul, Bratislava, Slovakia
1
by: | last post by:
Is there any way i can disable Font Style and Size Section that comes on Font Dialog Box.
2
by: tottigang | last post by:
Hi, I have a tabstrip and I have some tabs in it. On the first page, all the tabs are enabled, I need to disbale part of the tabs at a specific point in the application and again enable them. I...
0
by: Robert Ladd | last post by:
Hi, I'm trying to disable the asp.net calendar control from a javascript function, but it doesn't disable the doPostBack. To simplify the situation, assume a page with 4 controls. A...
3
by: Jim in Arizona | last post by:
I'm going insane! I don't know if it's just that the .net 2.0 framework is buggy or if it really is my code. This is pretty hard to explain since I can't even begin to nail down why this is...
5
by: Ike | last post by:
Does anyone know how to disable a list box element in VB 6 ? Thanks Ike
8
by: Arhaus | last post by:
I was wondering if someone could help me out. I am new to jscript and I need to modify a calendar onclick event. We have a calendar which displays the dates either in green or red based upon data...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.