New Line on pressing Enter key
Page 1 of 113 Replies - 11813 Views - Last Post: 09 October 2009 - 10:50 PM
#1
New Line on pressing Enter key
Posted 09 October 2009 - 02:56 AM
Also i have done the coding in such a way that when i use double backslash(\\) in text box then it automatically moves to new line in the picture box .
Now the problem is that i don't want to display the double slash in the text box, i want that when i press enter key then in the back end coding it should implement double backslash(\\) and moves to the new line in the picture box without displaying backslash in the text Box.
Can anyone help me in this............
Replies To: New Line on pressing Enter key
#2
Re: New Line on pressing Enter key
Posted 09 October 2009 - 03:23 AM
#3
Re: New Line on pressing Enter key
Posted 09 October 2009 - 03:34 AM
eclipsed4utoo, on 9 Oct, 2009 - 02:23 AM, said:
Yes its already true............
In textbox it will come in next line, but not come in picturebox.
Kindly help me related to this.
This post has been edited by avirag: 09 October 2009 - 03:51 AM
#4
Re: New Line on pressing Enter key
Posted 09 October 2009 - 04:49 AM
#5
Re: New Line on pressing Enter key
Posted 09 October 2009 - 04:55 AM
#6
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:08 AM
eclipsed4utoo, on 9 Oct, 2009 - 03:55 AM, said:
Well i m using Letex/mimeTex to convert the text of textbox in math format And the math output is display in a picturebox.
And according to Letex "\\" means new line.It means that whenever the user writes "\\", it gives a new line in picturebox,So i want that when the user presses enter key, it should show new line in picturebox as it gives in multiline textbox.
#7
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:28 AM
#8
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:36 AM
#9
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:39 AM
avirag, on 9 Oct, 2009 - 08:08 AM, said:
eclipsed4utoo, on 9 Oct, 2009 - 03:55 AM, said:
Well i m using Letex/mimeTex to convert the text of textbox in math format And the math output is display in a picturebox.
And according to Letex "\\" means new line.It means that whenever the user writes "\\", it gives a new line in picturebox,So i want that when the user presses enter key, it should show new line in picturebox as it gives in multiline textbox.
You can use the Key_Up event for the textbox and catch when the key is the Enter key. Then send "//" to the "equation" instead of the enter key..
private void mtxtContactPhone_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendToLetex(@"\\");
}
}
#10
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:47 AM
private void mtxtContactPhone_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendToLetex(@"\\");
}
}
[/quote]
Well i m using the below code, but its not showing any output......
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
FormatText("\\\\");
}
}
private string FormatText(string input)
{
input = input.Replace("\\\\", "\\\\");
return input;
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.textBox1.Focus();
WriteEquation(FormatText(textBox1.Text));
}
Kindly help me in this..........
#11
Re: New Line on pressing Enter key
Posted 09 October 2009 - 05:53 AM
Ok, so when you send the text to the WriteEquation method, you will need to replace the carriage return with "\\"..
WriteEquation(textBox1.Text.Replace("\r\n", @"\\");
So you don't need to use the Key_Down event after all.
#12
Re: New Line on pressing Enter key
Posted 09 October 2009 - 06:08 AM
eclipsed4utoo, on 9 Oct, 2009 - 04:53 AM, said:
Ok, so when you send the text to the WriteEquation method, you will need to replace the carriage return with "\\"..
WriteEquation(textBox1.Text.Replace("\r\n", @"\\");
So you don't need to use the Key_Down event after all.
Thanks for your reply, it works..............
#13
Re: New Line on pressing Enter key
Posted 09 October 2009 - 06:35 AM
eclipsed4utoo, on 9 Oct, 2009 - 04:53 AM, said:
Ok, so when you send the text to the WriteEquation method, you will need to replace the carriage return with "\\"..
WriteEquation(textBox1.Text.Replace("\r\n", @"\\");
So you don't need to use the Key_Down event after all.
Hi i have one more problem related to this.......
I am using the below code to unable only one space between the characters in the textBox, but in my code when user uses left arrow key, then he is able to use spacebar key more than once between characters.....
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
TextBox tb = (TextBox)sender;
if ((e.KeyChar == ' ') && (tb.Text.Length > 0))
{
if (tb.Text[tb.Text.Length - 1] == ' ')
e.Handled = true;
}
}
But i want that when the user presses left arrow key, in that case also user should not able to use the spacebar key more than once......
Kindly help me in this.......
This post has been edited by avirag: 09 October 2009 - 06:36 AM
#14
Re: New Line on pressing Enter key
Posted 09 October 2009 - 10:50 PM

New Topic/Question
Reply



MultiQuote



|