I have textbox. I do something in each Keypress (kindof validation) in order
not to rewrite all text inside I'm using AppendText method to write in. BUT
I'm unable to add backspace (\b); e.g I have to change each ZZ to Z so I
want to do myTextBox.Appen dText("\bZ"); or (char)8+"Z" - Both writes black
square and Z. I know bout the issue of Win32, but is any way to overrde it?
TNX
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us " 7 10388
Tamir,
A backspace character is still a character. Rather, when you detect the
second "Z", ignore it, don't append it to the textbox. This way, you don't
place the extra character, and you get the desired effect (one Z).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Tamir Khason" <ta**********@t con-NOSPAM.co.il> wrote in message
news:eQ******** ******@tk2msftn gp13.phx.gbl... I have textbox. I do something in each Keypress (kindof validation) in order not to rewrite all text inside I'm using AppendText method to write in. BUT I'm unable to add backspace (\b); e.g I have to change each ZZ to Z so I want to do myTextBox.Appen dText("\bZ"); or (char)8+"Z" - Both writes black square and Z. I know bout the issue of Win32, but is any way to overrde it?
TNX
-- Tamir Khason You want dot.NET? Just ask: "Please, www.dotnet.us "
I'd happy to be simple like that ;) ZZ it only example. It can be "Sd" as
well ;)
I found workaronds:
1) SendKey.Send("{ BS}"); //BAD GUY
2)
myTextbox.Selec tionStart = myTextbox.TextL ength-1;
myTextbox.Selec tionLength = 1;
myTextbox.Selec tedText="";
BOTH not quite like them.
Any other ideas?
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. .. Tamir,
A backspace character is still a character. Rather, when you detect the second "Z", ignore it, don't append it to the textbox. This way, you don't place the extra character, and you get the desired effect (one Z).
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Tamir Khason" <ta**********@t con-NOSPAM.co.il> wrote in message news:eQ******** ******@tk2msftn gp13.phx.gbl...I have textbox. I do something in each Keypress (kindof validation) in order not to rewrite all text inside I'm using AppendText method to write in. BUT I'm unable to add backspace (\b); e.g I have to change each ZZ to Z so I want to do myTextBox.Appen dText("\bZ"); or (char)8+"Z" - Both writes black square and Z. I know bout the issue of Win32, but is any way to overrde it?
TNX
-- Tamir Khason You want dot.NET? Just ask: "Please, www.dotnet.us "
Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to replace all the ZZ with Z
in a TextBox when a key is pressed. If there is any misunderstandin g,
please feel free to let me know.
Besides ignoring the second Z character, I think we can also use the
String.Replace method. When each key is pressed, we can handle the KeyUp
event to check if there is ZZ in the string. If yes, replace them with Z.
Here is a code snippet.
private void textBox1_KeyUp( object sender,
System.Windows. Forms.KeyEventA rgs e)
{
string s = this.textBox1.T ext.Replace("zz ","z");
this.textBox1.T ext = s;
}
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Thank you for response.
Two problems:
1) As I mentioned earlier - it not have to be double symbol - it can be
anything
2) It possible more then one ZZ (even legal) in the text
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:4c******** ******@cpmsftng xa10.phx.gbl... Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to replace all the ZZ with Z in a TextBox when a key is pressed. If there is any misunderstandin g, please feel free to let me know.
Besides ignoring the second Z character, I think we can also use the String.Replace method. When each key is pressed, we can handle the KeyUp event to check if there is ZZ in the string. If yes, replace them with Z. Here is a code snippet.
private void textBox1_KeyUp( object sender, System.Windows. Forms.KeyEventA rgs e) { string s = this.textBox1.T ext.Replace("zz ","z"); this.textBox1.T ext = s; }
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi Tamir,
1) In this case, you have to write several Replace in the event handler.
2) Replace method will replace all the ZZ in the text.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Hi Tamir,
I too am having a similar problem. It seems the code that follows does the
job:
myTextbox.Selec tionStart = myTextbox.TextL ength-1;
myTextbox.Selec tionLength = 1;
myTextbox.Selec tedText="";
But when I keep hitting the backspace button, to the begining, where there
are no more characters left, an error gets thrown. Any further solutions you
could throw my way?
MikeY
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:4c******** ******@cpmsftng xa10.phx.gbl... Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to replace all the ZZ with Z in a TextBox when a key is pressed. If there is any misunderstandin g, please feel free to let me know.
Besides ignoring the second Z character, I think we can also use the String.Replace method. When each key is pressed, we can handle the KeyUp event to check if there is ZZ in the string. If yes, replace them with Z. Here is a code snippet.
private void textBox1_KeyUp( object sender, System.Windows. Forms.KeyEventA rgs e) { string s = this.textBox1.T ext.Replace("zz ","z"); this.textBox1.T ext = s; }
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
* Problem of Z *
If only Z has to be replaced, best could be to do a Index search for the
text in textbox.
Condition 1- Text is typed in textbox
....this could be handled in Key event (or text change) and look for Z in
textbox. If Z is already there clear the last type.
Condition 2 - Copy and paste in textbox
Catch text change event and index search for Z, if it is there,
String.Replace it with single Z.
* Problem of Backspace *
Give attn to the condition when there is no text (Length = 0). You are
subtracting 1 in that condition. Check if (TextBox.TextLe ngth > 0) then you
do math on it.
Thanks.
"MikeY" <mi*******@yaho o.c> wrote in message
news:gr******** ************@ne ws20.bellglobal .com... Hi Tamir,
I too am having a similar problem. It seems the code that follows does the job:
myTextbox.Selec tionStart = myTextbox.TextL ength-1;
myTextbox.Selec tionLength = 1;
myTextbox.Selec tedText="";
But when I keep hitting the backspace button, to the begining, where there are no more characters left, an error gets thrown. Any further solutions you could throw my way?
MikeY
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message news:4c******** ******@cpmsftng xa10.phx.gbl... Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to replace all the ZZ with Z in a TextBox when a key is pressed. If there is any misunderstandin g, please feel free to let me know.
Besides ignoring the second Z character, I think we can also use the String.Replace method. When each key is pressed, we can handle the KeyUp event to check if there is ZZ in the string. If yes, replace them with Z. Here is a code snippet.
private void textBox1_KeyUp( object sender, System.Windows. Forms.KeyEventA rgs e) { string s = this.textBox1.T ext.Replace("zz ","z"); this.textBox1.T ext = s; }
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: haxmya |
last post by:
Ok, made an explorer toolbar (band Object) with a textbox on it.
Everything works great....except that the backspace button doesn't
actually backspace when you're in the textbox.
Shift-backspace works but regular backspace doesn't. Does anyone have
any ideas?
Posted Via Usenet.com Premium Usenet Newsgroup Services...
|
by: Adam Clauss |
last post by:
I've an application which is using a multiline textbox to log the status of a fairly long procedure. "Updates" are made to the
status by calling textbox.AppendText.
As my task is fairly lengthy, I go well past the default max text length of the textbox. According to the documentation, setting
MaxLength = 0 will increase this to basically...
|
by: Wilfried Mestdagh |
last post by:
Hello,
textBox += someData + "\r\n";
does not scroll the visible text to the end. How do I perform that ?
Also this way seems to me a lot of reallocating memory. Is there better way
to add text to a textbox ?
--
rgds, Wilfried
|
by: Grant Schenck |
last post by:
I want to append text to the end of a text box. If the cursor is currently
at the end I just want to append it and have the normal scrolling take place
if needed.
However, if the selection isn't at the end of the text box I want to append
the text but WITHOUT changing the selection or scrolling the text.
I can easily tell if the...
|
by: Andrew |
last post by:
VB .NET 2003, WinXP Pro:
Adding text to a text box with the TextBox.AppendText method limits the
amount of text in the textbox to 32K.
I have a short program that uses the GetFiles function of the directory
object, then iterates through the returned array and appends the strings to
the textbox. However, if the character count is greater...
| |
by: WALDO |
last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20
lines of text per second. I use the AppendText() method to accomplish this.
This is a great substitute for taking the Text property and concatenating
it...
Me.tb.Text &= newText
' Instead use
Me.tb.AppendText(newText)
....ultimately setting the SelectionStart...
|
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= |
last post by:
Hello,
I have a scrolling RichTextBox to which I add characters one at a time using
the AppendText method as they are received by my application. Some of these
characters may be backspace characters, which I need to somehow use to erase
the most recent character displayed in the last line displayed in the text
box. Of course, the...
|
by: Anil Gupte |
last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net.
However, I cannot for the life of me figure out how to write to a multiline
textbox. Basically, I have created an array of strings which I want to
"paste" into a multiline textbox. Any ideas?
--
Anil Gupte
www.keeninc.net
www.icinema.com
|
by: zacks |
last post by:
I have a multiline textbox control where I would like to load up with
something like the following:
This is Line 1 <- this line is NOT bold
This is Line 2 <- this line is bold
This is Line 3 <- this line is NOT bold
I have attempted to use C# code like the following:
string part1 = "This is Line 1" +...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |