By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

VB.net CF: Question about Textbox and/or Label

P: n/a
I've only recently got started using VB.net Compact Framework, and I'm
struggling to create a read-only Textbox with a white background.

Even though I can set the background colour of a textbox, as soon as I set
the control to read-only it turns the background grey. Unfortunately I
can't set the enabled property to false as sometimes I need the scrollbars
to work on the Textbox. I did think about using a label instead of a
Textbox, but there isn't an option to add a border to a Label (if I use a
Label I need it to look like a Textbox) and of course it has no scrollbar.

I know in VB6 it was possible to intercept the keypress event to prevent
text been added to a text box, is this possible using .Net CF?

Does anyone have any suggestions?

Thanks,

Simon
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Simon,

If I understand correctly, you want a read only textbox w/ a white
background, right?

I tried it and as you mentioned as soon as I changed the property ReadOnly =
True the appearance of the textbox changed and it appeared grey. However
changing the background color to say "Highlight Text" solved this problem.
Also after this change I reverted back the background color to "Windows" (the
default setting) and then it seemed to work fine.

HTH
Nov 21 '05 #2

P: n/a

"Sarika" <Sa****@discussions.microsoft.com> wrote in message
news:84**********************************@microsof t.com...
Simon,

If I understand correctly, you want a read only textbox w/ a white
background, right?
Yes, that's what I'm after.

I tried it and as you mentioned as soon as I changed the property ReadOnly = True the appearance of the textbox changed and it appeared grey. However
changing the background color to say "Highlight Text" solved this problem.
Also after this change I reverted back the background color to "Windows" (the default setting) and then it seemed to work fine.

HTH


Thanks for your suggestion; your right that it does change the background
back to white in the IDE, however when I compile the program and use either
my Handheld (ipaq 2210) or the Windows Mobile 2003 SE Emulator then the
textbox is gray.

I have tried using 'TextBox1.BackColor = System.Drawing.Color.White' after
the form has loaded but this has no effect.
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.