|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to stop disabled text boxes being greyed outI have an app that displays about 20 items of data in text boxes. Very
occasionally I need to allow these to be used for data entry, but the bulk of the time they are solely for information. They all sit in a GroupBox that is normally disabled, but is enabled when data can be edited. The users complain that when the GroupBox.Enabled=False, the greyed out text boxes are hard to read. I would like to find a way to disable the GroupBox whilst leaving the text boxes clearly visible. -- John Austin -- John Austin You might try setting each textbox's ReadOnly property to True, instead of
disabling them. Then when you wanted to enable (make them non ReadOnly), you could: For Each ctrl As Control In GroupBox1.Controls If TypeOf ctrl Is TextBox Then DirectCast(ctrl, TextBox).ReadOnly = False End If Next -- Show quoteHide quoteTerry "John Austin" wrote: > I have an app that displays about 20 items of data in text boxes. Very > occasionally I need to allow these to be used for data entry, but the bulk of > the time they are solely for information. They all sit in a GroupBox that is > normally disabled, but is enabled when data can be edited. The users complain > that when the GroupBox.Enabled=False, the greyed out text boxes are hard to > read. I would like to find a way to disable the GroupBox whilst leaving the > text boxes clearly visible. > -- > John Austin > > -- > John Austin Yes, I do a similar thing to set the text boxes BackColor in
GroupBox1.EnabledChanged so that it is obvious to the user when they can and can't type in the boxes. The thing I don't like about setting ReadOnly is that if the user can get the cursor in the box, they then phone up and ask why they can't type anything. I really want to make the Text Boxes look like labels when they can't type in them, and like text boxes when they can. Thanks for the suggestion. -- Show quoteHide quoteJohn Austin "Terry" wrote: > You might try setting each textbox's ReadOnly property to True, instead of > disabling them. Then when you wanted to enable (make them non ReadOnly), you > could: > > For Each ctrl As Control In GroupBox1.Controls > If TypeOf ctrl Is TextBox Then > DirectCast(ctrl, TextBox).ReadOnly = False > End If > Next > > -- > Terry > > > "John Austin" wrote: > > > I have an app that displays about 20 items of data in text boxes. Very > > occasionally I need to allow these to be used for data entry, but the bulk of > > the time they are solely for information. They all sit in a GroupBox that is > > normally disabled, but is enabled when data can be edited. The users complain > > that when the GroupBox.Enabled=False, the greyed out text boxes are hard to > > read. I would like to find a way to disable the GroupBox whilst leaving the > > text boxes clearly visible. > > -- > > John Austin > > > > -- > > John Austin Well, you could alwayws switch between labels and textboxes in code. The
reason that a readonly textbox can be 'entered' is to allow the user to see any text that may extend beyond the limits. In you don't want them to enter it when it is readonly add the following to each of the enter events. If TextBox1.ReadOnly = True Then Me.SelectNextControl(TextBox1, True, True, True, True) End If May be better to just use 'addhandler' here. Private Sub MoveAlong(Byval sender....) Me.SelectNextControl(Sender, True....) End Sub In any case, you get the idea. Also, if you really want them to look like labels, then when you set their ReadOnly property to true, also set their border style to 'None'. Then they will look exactly like labels and with the above code, can't be 'entered'. -- Show quoteHide quoteTerry "John Austin" wrote: > Yes, I do a similar thing to set the text boxes BackColor in > GroupBox1.EnabledChanged so that it is obvious to the user when they can and > can't type in the boxes. The thing I don't like about setting ReadOnly is > that if the user can get the cursor in the box, they then phone up and ask > why they can't type anything. I really want to make the Text Boxes look like > labels when they can't type in them, and like text boxes when they can. > > Thanks for the suggestion. > -- > John Austin > > > "Terry" wrote: > > > You might try setting each textbox's ReadOnly property to True, instead of > > disabling them. Then when you wanted to enable (make them non ReadOnly), you > > could: > > > > For Each ctrl As Control In GroupBox1.Controls > > If TypeOf ctrl Is TextBox Then > > DirectCast(ctrl, TextBox).ReadOnly = False > > End If > > Next > > > > -- > > Terry > > > > > > "John Austin" wrote: > > > > > I have an app that displays about 20 items of data in text boxes. Very > > > occasionally I need to allow these to be used for data entry, but the bulk of > > > the time they are solely for information. They all sit in a GroupBox that is > > > normally disabled, but is enabled when data can be edited. The users complain > > > that when the GroupBox.Enabled=False, the greyed out text boxes are hard to > > > read. I would like to find a way to disable the GroupBox whilst leaving the > > > text boxes clearly visible. > > > -- > > > John Austin > > > > > > -- > > > John Austin John
Although it is possible to use the Readonly property to lock the contents of a Texbox. As a user I would expect a normal looking textbox to be editable only to find that it is not. You may want to work with your uses to see how they feel about this. Sometimes could be quite frustrating unless you show them some visual cue as to when it is disabled and when enabled for editing. Regards, Trevor Benedict MCSD Show quoteHide quote "John Austin" <John.Austin@nospam.nospam> wrote in message news:4DA49FEE-1BFC-4EFD-A202-5E898D9BEEFF@microsoft.com... >I have an app that displays about 20 items of data in text boxes. Very > occasionally I need to allow these to be used for data entry, but the bulk > of > the time they are solely for information. They all sit in a GroupBox that > is > normally disabled, but is enabled when data can be edited. The users > complain > that when the GroupBox.Enabled=False, the greyed out text boxes are hard > to > read. I would like to find a way to disable the GroupBox whilst leaving > the > text boxes clearly visible. > -- > John Austin > > -- > John Austin Our postings have crossed - I agree!
-- Show quoteHide quoteJohn Austin "Trevor Benedict" wrote: > John > Although it is possible to use the Readonly property to lock the contents of > a Texbox. As a user I would expect a normal looking textbox to be editable > only to find that it is not. You may want to work with your uses to see how > they feel about this. Sometimes could be quite frustrating unless you show > them some visual cue as to when it is disabled and when enabled for editing. > > Regards, > > Trevor Benedict > MCSD > > "John Austin" <John.Austin@nospam.nospam> wrote in message > news:4DA49FEE-1BFC-4EFD-A202-5E898D9BEEFF@microsoft.com... > >I have an app that displays about 20 items of data in text boxes. Very > > occasionally I need to allow these to be used for data entry, but the bulk > > of > > the time they are solely for information. They all sit in a GroupBox that > > is > > normally disabled, but is enabled when data can be edited. The users > > complain > > that when the GroupBox.Enabled=False, the greyed out text boxes are hard > > to > > read. I would like to find a way to disable the GroupBox whilst leaving > > the > > text boxes clearly visible. > > -- > > John Austin > > > > -- > > John Austin > > > I agree, but a ReadOnly textbox is not normal looking. It has a 'control'
color background. Also, if you clue your users by changing the background when they enter it, you can skip that for a readonly. -- Show quoteHide quoteTerry "Trevor Benedict" wrote: > John > Although it is possible to use the Readonly property to lock the contents of > a Texbox. As a user I would expect a normal looking textbox to be editable > only to find that it is not. You may want to work with your uses to see how > they feel about this. Sometimes could be quite frustrating unless you show > them some visual cue as to when it is disabled and when enabled for editing. > > Regards, > > Trevor Benedict > MCSD > > "John Austin" <John.Austin@nospam.nospam> wrote in message > news:4DA49FEE-1BFC-4EFD-A202-5E898D9BEEFF@microsoft.com... > >I have an app that displays about 20 items of data in text boxes. Very > > occasionally I need to allow these to be used for data entry, but the bulk > > of > > the time they are solely for information. They all sit in a GroupBox that > > is > > normally disabled, but is enabled when data can be edited. The users > > complain > > that when the GroupBox.Enabled=False, the greyed out text boxes are hard > > to > > read. I would like to find a way to disable the GroupBox whilst leaving > > the > > text boxes clearly visible. > > -- > > John Austin > > > > -- > > John Austin > > >
VB2008 changes?
Call HTML control in code behind (ASP.net 2.0) Visual Studio 2005: VB fill circle automatic Can I write this program? Setting up Policies to run Exe file from network drive Kill explorer process and disable it restart automatically Problem Using VB.net Class Library DLL in VBScript [VB2008] How to replace lines in a textfile? using foxpro table from VB.net 2005 with oledb DLL NOT FOUND (but only on certain systems???) |
|||||||||||||||||||||||