C# ගැටළුවක් [ Help එකක් ]

markhaloce

Member
Mar 7, 2013
10,298
677
0
17
The Real North
PHP:
textBox1.Select(startPos, endPos);
            textBox1.HideSelection = false;

:yes: මේක වැඩ...
උඹ උඩ ටෙක්ස්ට් බොක්ස් එකේ සිලෙක්ට් කරද්දි සිලෙක්ට් කරන්න පටං ගන්න තැනයි සිලෙක්ට් කල්ල ඉවර වෙන තැනයි පොසිශන්ස් ගනිං.. :yes:
ඒව අරගෙන startPos, endPos වලට ඒ වැලියුස් දුන්නාම හරි :yes:


එඩිට් කරන ලදී :yes:

textboxes දෙකක් තියෙනවනං මෙන්න මේ ක්‍රමේට ලියපං.. :yes:
PHP:
private void textBox1_MouseUp(object sender, MouseEventArgs e)
        {
            int startPos = textBox1.SelectionStart;
            int len = textBox1.SelectedText.Length;

            textBox2.Select(startPos, len);
        }
මේකෙ ටෙක්ස්ට් එක තමා උඹ සෙලෙක්ට් කරන්නෙ..
ඔය ඔක්කොටම කලින් උඹ සෙලෙක්ට් කරන්න බලාපොරොත්තු වෙන ටෙක්ස්ට්බොක්ස් එකට
PHP:
textBox.HideSelection = false;
දීල ඉඳපං නැත්තං සිලෙක්ට් කලාට පේන්නෑ..
ඔය ක්‍රමේ මට නං වැඩ :yes:


Untitled.png
 
Last edited:

DjSpK

Well-known member
  • Nov 4, 2008
    5,298
    1,005
    113
    I'm Looking for Me !
    Code:
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                textBox1.MouseUp += MouseUpHandler;
            }
            void MouseUpHandler(Object sender, MouseEventArgs args)
            {
                richTextBox1.SelectionBackColor = Color.White;
                if (textBox1.SelectionLength > 0) {
                        richTextBox1.Find(textBox1.SelectedText , 0, richTextBox1.TextLength, RichTextBoxFinds.None);
                        richTextBox1.SelectionBackColor = Color.Yellow;
               }
            }
        }
    }
     

    මම බෙනා

    Well-known member
  • Sep 8, 2012
    5,428
    970
    113
    ලංකාවේ
    PHP:
    textBox1.Select(startPos, endPos);
                textBox1.HideSelection = false;
    :yes: මේක වැඩ...
    උඹ උඩ ටෙක්ස්ට් බොක්ස් එකේ සිලෙක්ට් කරද්දි සිලෙක්ට් කරන්න පටං ගන්න තැනයි සිලෙක්ට් කල්ල ඉවර වෙන තැනයි පොසිශන්ස් ගනිං.. :yes:
    ඒව අරගෙන startPos, endPos වලට ඒ වැලියුස් දුන්නාම හරි :yes:


    එඩිට් කරන ලදී :yes:

    textboxes දෙකක් තියෙනවනං මෙන්න මේ ක්‍රමේට ලියපං.. :yes:
    PHP:
    private void textBox1_MouseUp(object sender, MouseEventArgs e)
            {
                int startPos = textBox1.SelectionStart;
                int len = textBox1.SelectedText.Length;
    
                textBox2.Select(startPos, len);
            }
    මේකෙ ටෙක්ස්ට් එක තමා උඹ සෙලෙක්ට් කරන්නෙ..
    ඔය ඔක්කොටම කලින් උඹ සෙලෙක්ට් කරන්න බලාපොරොත්තු වෙන ටෙක්ස්ට්බොක්ස් එකට
    PHP:
    textBox.HideSelection = false;
    දීල ඉඳපං නැත්තං සිලෙක්ට් කලාට පේන්නෑ..
    ඔය ක්‍රමේ මට නං වැඩ :yes:


    Untitled.png

    වරෙන් උම්ම එකක් දෙන්ඩ... :P :love: Rep ++

    ඒ මගෙ වැඩ නෑනෙ බන්...:sorry: මට උඹ හදපු Project කැල්ල දෙන්ඩකො බලන්ඩ... :)

    මොකක්ද බන් අර values දෙන්ඩ කිවුවෙ... :confused:

    textbox 2ක් තමා යූස් කෙරුවෙ... :eek:
     

    මම බෙනා

    Well-known member
  • Sep 8, 2012
    5,428
    970
    113
    ලංකාවේ
    Code:
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                textBox1.MouseUp += MouseUpHandler;
            }
            void MouseUpHandler(Object sender, MouseEventArgs args)
            {
                richTextBox1.SelectionBackColor = Color.White;
                if (textBox1.SelectionLength > 0) {
                        richTextBox1.Find(textBox1.SelectedText , 0, richTextBox1.TextLength, RichTextBoxFinds.None);
                        richTextBox1.SelectionBackColor = Color.Yellow;
               }
            }
        }
    }


    මචන් Textbox2 ක් යූස් කොරලා මේක කරගන්ඩ බැරිද...Richtextbox ගාව ගන්නේ නැතුව
    :yes: :confused:

    Anyway Thnkzzzzz මචා
    :yes: ;) :)
     

    Jolly_Roger

    Well-known member
  • May 2, 2009
    10,600
    1,606
    113
    Colombo XOR Matara
    මම බෙනා;18089982 said:
    java danne na sahooo;)

    javascript kiyanne java nemei. a deka completely wenas dekak. :):)
    javascriptswalin karanna lesi habai web based nam. ube app ekawindows ne. :cool:
    prashne wisadunada? nathnam thama wade karaganna bari unada? :nerd::nerd:
     

    Jolly_Roger

    Well-known member
  • May 2, 2009
    10,600
    1,606
    113
    Colombo XOR Matara
    menna machan code eka


    private void textBox1_MouseUp_1(object sender, MouseEventArgs e)
    {
    if (textBox1.SelectedText != "")
    {
    if (!String.IsNullOrEmpty(textBox2.Text))
    {
    int pos = textBox1.Text.IndexOf(textBox1.SelectedText);
    int length = textBox1.SelectedText.Length;
    textBox2.Select(pos, length);
    textBox2.HideSelection = false;
    }
    }
    }


    ube textbox1 eke mouse up event ekata oka dapan. awlak awoth kiyapan.
    :)

    az6iv9.jpg
     
    Last edited:
    • Like
    Reactions: The_Killer

    මම බෙනා

    Well-known member
  • Sep 8, 2012
    5,428
    970
    113
    ලංකාවේ
    menna machan code eka


    private void textBox1_MouseUp_1(object sender, MouseEventArgs e)
    {
    if (textBox1.SelectedText != "")
    {
    if (!String.IsNullOrEmpty(textBox2.Text))
    {
    int pos = textBox1.Text.IndexOf(textBox1.SelectedText);
    int length = textBox1.SelectedText.Length;
    textBox2.Select(pos, length);
    textBox2.HideSelection = false;
    }
    }
    }


    ube textbox1 eke mouse up event ekata oka dapan. awlak awoth kiyapan.
    :)

    az6iv9.jpg


    වැඩේ හරි ගියා මචා...ඒත් ඔයාගේ ක්‍රමෙත් ගොඩක් වටිනවා...Thankzzz Thnkzzz Thankzzzz :yes: :yes: :yes:
    Rep ++++++
    වැඩේ හරි ගියා මචා....ඒත් ඔයාගේ ක්‍රමෙත් ගොඩක් වටිනවා...Thankzzz Thnkzzz Thankzzzz
    සහෝ..
    ඔයා ගොඩක් දේවල් වලට මට හෙල්ප් කරනවා :yes: ;) :) :love: