CODING FOR JUST SIMPLE TRY
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'a')
{
awrite();
}
public void awrite()
{
char aleph;
string word;
aleph = 'u0627';
word = aleph.ToString();
textBox1.Text = word;
}
}
BUT PROBLEM WITH THIS CODING IS THA IT WIRTES ALEPH WITH A LETTER TOO AND WHEN I PRESS A AGAIN IT DOESNT WIRTE ANY THING PLZZZZZZZZ HELP!!!!!!
Comments
[code] textBox1.Text = word; [/code]
You should have:
[code] textBox1.Text = textBox1.Text + word; [/code]
Or
[code] textBox1.Text += word; [/code]
If I understand you correctly, you are saying it still inputs the 'a' letter, though you don't want it to? if that is the case, simply omit it using substring:
[code] Tlen = textBox1.Text.Length
textBox1.Text = textBox1.Text.Substring(0, Tlen -1) + word; [/code]
That's all I can think of, let me know if it's something else. Dai.
------------------------------------------
Do or do not, there is no try. |
------------------------------------------
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'j')
{
jwrite();
}
if (e.KeyChar == 'm')
{
mwrite();
}
if (e.KeyChar == 's')
{
swrite();
}
if (e.KeyChar == 'u')
{
uwrite();
}
if (e.KeyChar == 'd')
{
dwrite();
}
e.Handled = true;
}
public void jwrite()
{
char jeem;
string word;
jeem= 'u062C';
word = jeem.ToString();
textBox1.Text += word;
}
public void mwrite()
{
char meem;
string word;
meem = 'u0645';
word = meem.ToString();
textBox1.Text += word;
}
public void swrite()
{
char shen;
string word;
shen = 'u0634';
word = shen.ToString();
textBox1.Text += word;
}
public void swrite()
{
char shen;
string word;
shen = 'u0634';
word = shen.ToString();
textBox1.Text += word;
}
public void dwrite()
{
char dal;
dal = 'u062F';
string word;
word =dal.ToString();//+ ra.ToString()+dal.ToString()+ wao.ToString();
textBox1.Text += word;
}
in this coding i have an other problem my cursor is not moving while writing text and i can't make editing in the text box i mean when i edit in text box it again insert seprate urdu charactor it doesn't append the charactor with the current text where i want so plssssssssssssss help!!!!!!!
[code] TextBox1.SelectionStart = TextBox1.Text.Length [/code]
after the[red] textBox1.Text += word; [/red]line.
------------------------------------------
Do or do not, there is no try. |
------------------------------------------
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'a')
{
awrite();
}
if (e.KeyChar == 'd')
{
dwrite();
}
if (e.KeyChar == 'j')
{
jwrite();
}
if (e.KeyChar == 'm')
{
mwrite();
}
if (e.KeyChar == 's')
{
swrite();
}
if (e.KeyChar == 'u')
{
uwrite();
}
e.Handled = true;
if (e.KeyChar == (char)Keys.Space)
{
e.Handled = false;
textBox1.SelectionStart = textBox1.Text.Length;
}
//char aleph ;
// string word;
//aleph = 'u0627';
/* char ra;
char dal;
char wao;
string word;
aleph = 'u0627';
ra = 'u0631';
dal = 'u062F';
wao = 'u0648';
* */
// word = aleph.ToString();//+ ra.ToString()+dal.ToString()+ wao.ToString();
// textBox1.Text = word;
}
public void uwrite()
{
char ye;
string word;
ye = 'u06CC';
word = ye.ToString();
textBox1.Text += word;
// int Tlen = textBox1.Text.Length;
// textBox1.Text = textBox1.Text.Substring(0, Tlen - 1) + word;
textBox1.SelectionStart = textBox1.Text.Length;
}
public void swrite()
{
char shen;
string word;
shen = 'u0634';
word = shen.ToString();
textBox1.Text += word;
// int Tlen = textBox1.Text.Length;
// textBox1.Text = textBox1.Text.Substring(0, Tlen - 1) + word;
textBox1.SelectionStart = textBox1.Text.Length;
}
public void mwrite()
{
char meem;
string word;
meem = 'u0645';
word = meem.ToString();
textBox1.Text += word;
//int Tlen = textBox1.Text.Length;
// textBox1.Text = textBox1.Text.Substring(0, Tlen - 1) + word;
textBox1.SelectionStart = textBox1.Text.Length;
}
public void jwrite()
{
char jeem;
string word;
jeem= 'u062C';
word = jeem.ToString();
textBox1.Text += word;
int Tlen = textBox1.Text.Length;
textBox1.Text = textBox1.Text.Substring(0, Tlen - 1) + word;
textBox1.SelectionStart = textBox1.Text.Length;
}
public void awrite()
{
char aleph;
string word;
aleph = 'u0627';
word = aleph.ToString();
textBox1.Text += word;
// int Tlen = textBox1.Text.Length;
// textBox1.Text = textBox1.Text.Substring(0, Tlen - 1)+word;
textBox1.SelectionStart = textBox1.Text.Length;
}
public void dwrite()
{
char dal;
dal = 'u062F';
string word;
word =dal.ToString();
textBox1.Text += word;
// int Tlen = textBox1.Text.Length;
textBox1.SelectionStart = textBox1.Text.Length;
//textBox1.Text = textBox1.Text.Substring(0, Tlen - 1)+word;
}
First add these public variables:
[code]
public partial class Form1 : Form
{
string str1;
string str2;
int CursPos;
[/code]
Then change next part to:
[code]
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (textBox1.SelectionStart < textBox1.Text.Length)
{
str1 = textBox1.Text.Substring(0, textBox1.SelectionStart);
str2 = textBox1.Text.Substring(textBox1.SelectionStart);
CursPos = textBox1.SelectionStart +1;
}
else
{
str1 = textBox1.Text;
str2 = "";
}
if (e.KeyChar == 'a')
{
awrite();
}
// Rest of code as normal until public void uwrite
[/code]
Then at public void uwrite:
[code]
public void uwrite()
{
char ye;
string word;
ye = 'u06CC';
word = ye.ToString();
textBox1.Text = str1 + word + str2;
// int Tlen = textBox1.Text.Length;
// textBox1.Text = textBox1.Text.Substring(0, Tlen - 1) + word;
if (str2 == "")
{
textBox1.SelectionStart = textBox1.Text.Length;
}
else
{
textBox1.SelectionStart = CursPos;
}
}
[/code]
Apply above alteration to swrite, dwrite etc. You should find now that it works as intended, let me know either way. Dai.
------------------------------------------
Do or do not, there is no try. |
------------------------------------------
private void button1_Click(object sender, EventArgs e)
{
char aleph ;
char ra;
char dal;
char wao;
string word;
char jeem;
jeem = 'u062C';
char meem;
meem = 'u0645';
char shen;
shen = 'u0634';
aleph = 'u0627';
ra = 'u0631';
dal = 'u062F';
wao = 'u0648';
char ye;
ye = 'u06CC';
word = dal.ToString();
word +=ye.ToString();
word += shen.ToString();
word += meem.ToString();
word+=jeem.ToString();
textBox1.Text = word;
}
public void jwrite()
{
char jeem;
string word;
jeem = 'u062C';
word = jeem.ToString();
textBox1.Text += word;
}
private void button1_Click(object sender, EventArgs e)
{
char aleph ;
char ra;
char dal;
char wao;
string word;
char jeem;
jeem = 'u062C';
char meem;
meem = 'u0645';
char shen;
shen = 'u0634';
aleph = 'u0627';
ra = 'u0631';
dal = 'u062F';
wao = 'u0648';
char ye;
ye = 'u06CC';
word = dal.ToString();
word +=ye.ToString();
word += shen.ToString();
word += meem.ToString();
word+=jeem.ToString();
textBox1.Text = word;
}
public void jwrite()
{
char jeem;
string word;
jeem = 'u062C';
word = jeem.ToString();
textBox1.Text += word;
}
JOB REQUIRED +923207197224
https://www.sites.google.com/site/urdutextbox7/
alos visit products page of my site for skill level : musadiq.brinkser.net