?
Solved

How to disable textbox without text going dull grey

Posted on 2012-08-25
9
Medium Priority
?
934 Views
Last Modified: 2012-08-29
The environment is a vb.net mobile app, using visual studio 2008, running on .net framework 3.5.  The app runs on a Symbol 9090 mobile computer.  I have text boxes on my forms such as total accumulators, that I don't want the user to be able accidentally focus on with the touch screen, i.e. if he does touch it, I want the app to completely ignore him.

I can accomplish this by setting the 'Enabled' property for that textbox to 'False'.  But the problem is that the information showing in the text box--such as grand total--becomes a dull grey.  The number in the field is no longer a dark black--like it was before I disabled it.

Note that I tried using the 'ReadOnly' property, setting it to 'True', and while it did not allow the user to enter data, it did allow them to focus on that field, placing the cursor there.  So, that did not solve it.

Any way to make the text in the disabled text box look normal--or at least something better than a dull grey?  TIA
0
Comment
Question by:sasllc
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:Baleboos
ID: 38333414
Change the "Backcolor" property to a color of your liking. Disabling a control simply makes it appear in its backcolor instead of the color property.
0
 
LVL 3

Author Comment

by:sasllc
ID: 38333424
My BackColor on the textbox is 'Orange', and when I run the app, the color of the textbox is still bright orange, just like it was before I disabled it.  But it's the text in the orange box that's dull grey, rather than its usual dark black.

So this makes me wonder if it has to do with the 'ForeColor' somehow.  In my code, the 'Forecolor' shows a black box with 'Windows Text' to the right.  Is THAT what is actually turning a dull grey?  If so, what syntax can I use to make it stay dark black on the screen when I run the app?
0
 
LVL 3

Author Comment

by:sasllc
ID: 38333468
With 'Enabled' set to 'False', I added this line to my code:

Me.TxtGrandTot.ForeColor = Color.Black

...and it still showed as a dull grey.  Next I changed that line of code to '...Color.Green., but it still remains grey.

Is there some other parameter I can set to make the numbers appear dark black like normal?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Accepted Solution

by:
Baleboos earned 800 total points
ID: 38333526
Can't change the text color in a disabled box. However, you can simply set cancel=true in the validating event with perhaps a msgbox advising the user that changing the control is a big no no. (And leave it enabled.)
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 800 total points
ID: 38333609
If the control shows a total, the user usually does not need to edit it. Why not use a Label instead?

Or if the user need to edit in some conditions but not in others, simply disable the control but overlay it with a Label of the same size while it is disabled.
0
 
LVL 9

Assisted Solution

by:AsishRaj
AsishRaj earned 400 total points
ID: 38333761
this is something i use to do in my applications, haven't tried in mobile application but u can give it a go

Set the textbox's .locked property to "True"....
but the mouse can still focus or click to it.

To Prevent this from happening
you would need to disable the focus in the Got Focus event of textbox.
0
 
LVL 2

Expert Comment

by:Baleboos
ID: 38334067
vb.net locked is not the same as VB6 locked. The equivalent of VB6 locked is "readonly". Locked in vb.net refers to design, not runtime.

Author says "readonly" isn't sufficient.

Perhaps you can make it readonly and have an "onfocus" event that moves the focus to the next control in the tab order.
0
 
LVL 3

Author Comment

by:sasllc
ID: 38334122
On the concept of using a label rather than a textbox...for years the form has appeared to the user as in the attached file, with the totals (in the lower left) displaying nice and clear in their text boxes, black numbers against an orange background.  I'm using labels above the text boxes to describe that type of total.

In the attached file, the 'Location Total' is clear black, but the 'Grand Total' is not, because it's the textbox I had disabled in my testing.

I'd be interested in seeing an example that someone had done for accumulating totals, that's as easy to read as my label/text box approach has been.  Maybe I'll need to switch to that solution.
ScreenShot009.bmp
0
 
LVL 40
ID: 38334208
You do not have to use bright colors to attract the attention. In fact, that is one of the reasons that modern applications do not use those bright colored backgrounds. If most of the form is neutral, you can attract the attention with just a dash of color here and there.

In the standard grey Windows form, with text all in black, simply set your total in blue and in bold, it will jump at the user.

And is it really necessary to attract the attention to something as a total. If the form is always used by the same users, they will know where to look for the second time they will use the application.

And standard locations might be a better way to properly design a form. Look in the work around you, the total is almost always in the lower right corner. This is where people will look intuitively for a total.

Bold and in the lower right corner is as efficient as colorful, and will give a more modern look to your applications anyway.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question