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

S

Simon

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
 
G

Guest

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
 
S

Simon

Sarika said:
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.
 
G

Guest

Hmm........I tried comiling and executing the program and it appeared to
work. Do you think it might be a OS thing?
 
S

Simon

Sarika said:
Hmm........I tried comiling and executing the program and it appeared to
work. Do you think it might be a OS thing?

Could be; I'm using the Compact Framework on Windows Mobile 2003 and 2003
SE.

I've found a few other people who have reported the problem but no fix; what
I did find was a Command Button in OpenNetCF that you can change the
properties on to look a bit like a text box, so I think I'm going to use
that unless anyone has any better idea's.

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top