HighTechTalks DotNet Forums  

How to prevent SELECTION by user, in TEXTBOX ?

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss How to prevent SELECTION by user, in TEXTBOX ? in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
tony
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 03:41 AM







Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text in
the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Quote:
Why must it be enabled, but not selectable? Tell us *what* you are trying
to do, *not* how you've decided to do it. We can give you a good answer
that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.






Reply With Quote
  #12  
Old   
tony
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 03:41 AM







Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text in
the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Quote:
Why must it be enabled, but not selectable? Tell us *what* you are trying
to do, *not* how you've decided to do it. We can give you a good answer
that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.






Reply With Quote
  #13  
Old   
tony
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 03:41 AM




Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text in
the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Quote:
Why must it be enabled, but not selectable? Tell us *what* you are trying
to do, *not* how you've decided to do it. We can give you a good answer
that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.






Reply With Quote
  #14  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 09:57 AM



So, the problem is that ReadOnly isn't working, NOT THAT YOU NEED TO PREVENT
SELECTION OF TEXT! Give us the details on your environment. You haven't
told us what the target device is (Windows Mobile? Windows CE? Version?),
what version of .NET Compact Framework you are working with, etc. It might
be worthwhile to build a simple custom textbox that demonstrates the
problem, verify that it exists in that case, and post the code. Can we
presume, also, that regular Textbox controls *do* work correctly with
respect to ReadOnly for you? I can't find any situations where ReadOnly
doesn't work.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text
in the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Why must it be enabled, but not selectable? Tell us *what* you are
trying to do, *not* how you've decided to do it. We can give you a good
answer that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.








Reply With Quote
  #15  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 09:57 AM



So, the problem is that ReadOnly isn't working, NOT THAT YOU NEED TO PREVENT
SELECTION OF TEXT! Give us the details on your environment. You haven't
told us what the target device is (Windows Mobile? Windows CE? Version?),
what version of .NET Compact Framework you are working with, etc. It might
be worthwhile to build a simple custom textbox that demonstrates the
problem, verify that it exists in that case, and post the code. Can we
presume, also, that regular Textbox controls *do* work correctly with
respect to ReadOnly for you? I can't find any situations where ReadOnly
doesn't work.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text
in the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Why must it be enabled, but not selectable? Tell us *what* you are
trying to do, *not* how you've decided to do it. We can give you a good
answer that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.








Reply With Quote
  #16  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 09:57 AM



So, the problem is that ReadOnly isn't working, NOT THAT YOU NEED TO PREVENT
SELECTION OF TEXT! Give us the details on your environment. You haven't
told us what the target device is (Windows Mobile? Windows CE? Version?),
what version of .NET Compact Framework you are working with, etc. It might
be worthwhile to build a simple custom textbox that demonstrates the
problem, verify that it exists in that case, and post the code. Can we
presume, also, that regular Textbox controls *do* work correctly with
respect to ReadOnly for you? I can't find any situations where ReadOnly
doesn't work.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text
in the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Why must it be enabled, but not selectable? Tell us *what* you are
trying to do, *not* how you've decided to do it. We can give you a good
answer that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.








Reply With Quote
  #17  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: How to prevent SELECTION by user, in TEXTBOX ? - 07-01-2008 , 09:57 AM



So, the problem is that ReadOnly isn't working, NOT THAT YOU NEED TO PREVENT
SELECTION OF TEXT! Give us the details on your environment. You haven't
told us what the target device is (Windows Mobile? Windows CE? Version?),
what version of .NET Compact Framework you are working with, etc. It might
be worthwhile to build a simple custom textbox that demonstrates the
problem, verify that it exists in that case, and post the code. Can we
presume, also, that regular Textbox controls *do* work correctly with
respect to ReadOnly for you? I can't find any situations where ReadOnly
doesn't work.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
Hi,

The problem is I created custom textbox ,
I want to prevent the user to change the text.

For some reason the Text.ReadOnly did not prevent the user to write text
in the TextBox,
so i create custom read only that will return immedialy from Key events.

till here everything was O.K

but then, i notice that if i select the text and then write somthing, the
text is changed, although i had the custom readonly=true.

Thanking in advance,


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote

Why must it be enabled, but not selectable? Tell us *what* you are
trying to do, *not* how you've decided to do it. We can give you a good
answer that way.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:g492me$ejn$1 (AT) news4 (DOT) netvision.net.il...
Hi,

I want to prevent the user, from selecting text (blue selection) in
TextBox , How can i do this ?

(the textbox must be enabled=true)
Thanking in advance.








Reply With Quote
  #18  
Old   
PrTaS
 
Posts: n/a

Default How to prevent SELECTION by user, in TEXTBOX ? - 07-28-2008 , 10:00 AM



I also could not imagine why it does not work but you may try this:

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}

Reply With Quote
  #19  
Old   
PrTaS
 
Posts: n/a

Default How to prevent SELECTION by user, in TEXTBOX ? - 07-28-2008 , 10:00 AM



I also could not imagine why it does not work but you may try this:

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}

Reply With Quote
  #20  
Old   
PrTaS
 
Posts: n/a

Default How to prevent SELECTION by user, in TEXTBOX ? - 07-28-2008 , 10:00 AM



I also could not imagine why it does not work but you may try this:

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.