473,626 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

?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 14569
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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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*******@hotm ail.com> wrote in message
news:OM******** ******@TK2MSFTN GP11.phx.gbl...

? "Rich" <an*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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

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

Similar topics

2
9731
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 in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled otherwise it has to be disabled.Here's what i've done so far: Do While Not ObjRS.EOF <td><input...
2
6445
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 to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled...
0
1258
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
3667
by: | last post by:
Is there any way i can disable Font Style and Size Section that comes on Font Dialog Box.
2
3418
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 have a hard time doing this. This is concerned with a production issue. Could anyone please suggest me a solution to this. I appreciate your time and help.
0
3359
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 dropdownlist, a calendar control, a textbox and an update button. What I'm doing is initially setting the button to disabled, the other 3 controls are enabled. If any data is entered in the textbox, I want to disable the dropdownlist and the calendar...
3
1685
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 happening. I have two text boxes. One is for the ID number, which when postback occurs, inserts into the related table as the foreign key. The other text box is for notes that go along side the foreign key of the the related table. Basically, the...
5
6051
by: Ike | last post by:
Does anyone know how to disable a list box element in VB 6 ? Thanks Ike
8
4133
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 from a string variable: Valiable example: var t = tDate; tDate = "4/10/2009,4/24/2009,5/8/2009,5/22/2009" The code is written to find a date in the tDate string, then the day number is Green or Red. My question is that the jscript makes all...
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.