C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
HOW I CAN WRITE URDU LANGUAGE IN TEXT BOX Posted by jamshed_ahmed2 on 4 Aug 2009 at 1:56 AM
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!!!!!!
Report
Re: HOW I CAN WRITE URDU LANGUAGE IN TEXT BOX Posted by DaiMitnick on 4 Aug 2009 at 7:24 AM
Only problem I can see with this code is that you are overwriting the textbox with just the string value of word each time instead of:

 textBox1.Text = word; 


You should have:

 textBox1.Text = textBox1.Text + word; 

Or
 textBox1.Text += word; 


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:

 Tlen = textBox1.Text.Length
 textBox1.Text = textBox1.Text.Substring(0, Tlen -1) + word; 


That's all I can think of, let me know if it's something else. Dai.


------------------------------------------
Do or do not, there is no try. |
------------------------------------------
Report
Re: yeahhhhhhh thx dai but still got problem Posted by jamshed_ahmed2 on 5 Aug 2009 at 2:28 AM
here is my modified coding

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!!!!!!!

Attachment: simplepicUrdu.jpg (21866 Bytes | downloaded 133 times)
Report
C# Keypress Posted by DaiMitnick on 8 Aug 2009 at 4:13 PM
Hi, sorry for the late reply, you've probably solved it by now but anyway, I got the same problem as you and fixed it by adding:
 TextBox1.SelectionStart = TextBox1.Text.Length 

after the textBox1.Text += word; line.
------------------------------------------
Do or do not, there is no try. |
------------------------------------------
Report
DAI IT'S REALLY MAKES ME ANGER Posted by jamshed_ahmed2 on 11 Aug 2009 at 1:59 AM
DAI AFTER HAVING TRY OF 6 DAYS I COUDN'T FIXED IT NOW THERE IS AN OTHER PROBLEM NOW THE CURSOR MOVES WHILE WRITTING ON IT BUT WHEN I HIT THE SPACE BAR THE CURSOR AGAIN MOVES IN THE END OF TEXT OF TEXTBOX AND WHEN I ENTER NEW CHARCTOR IN THE BETWEEN WORD IT APPENDS THAT CHARACTOR IN THE END OF WORD MY CODING IS GIVEN BELOW PLEASEEEEEEE HELP I GUESS IT'S ABOUT TO COMPLETE..BUT REQUIRES UR HELP

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;


}
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by DaiMitnick on 13 Aug 2009 at 10:53 AM
Hi, sorry it took so long for a reply, had to wipe pc and re-install everything. To overcome this problem, you need to simply split the string in 2 and add the text in right place. Here's the modified bits of code:

First add these public variables:

    public partial class Form1 : Form
    {
        string str1;
        string str2;
        int CursPos;


Then change next part to:

        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


Then at public void uwrite:

        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;
            }
        }


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. |
------------------------------------------
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by umairsabri on 21 Nov 2011 at 2:28 AM
when i am trying urdu in my project it is not joing all words like jamshaid is shown separately jeem sheen like this what is problem with it.here is my code
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;

}
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by umairsabri on 21 Nov 2011 at 2:32 AM
when i am trying urdu in my project it is not joing all words like jamshaid is shown separately jeem sheen like this what is problem with it.here is my code
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;

}
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by Alyssaly on 14 Dec 2011 at 11:41 PM
So nice~I am a fun of c#.But I gave up later!
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by Alyssaly on 14 Dec 2011 at 11:58 PM
So nice~I am a fun of c#.But I gave up later!
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by Alyssaly on 15 Dec 2011 at 12:17 AM
So nice~I am a fun of c#.But I gave up later!
Report
Re: DAI IT'S REALLY MAKES ME ANGER Posted by Alyssaly on 15 Dec 2011 at 12:23 AM
So nice~I am a fun of c#.But I gave up later!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.