simple code from c# App to ASP.net

  • Status: Closed
  • Pris: $10
  • Bidrag mottagna: 4
  • Vinnare: TCrabtree

Tävlingssammandrag

I have already code in c# which enables to change specific line in Textbox1 based on the start word in the line.
For Example: If those 3 lines written in TextBox1:
Hello Every body
Hi
Welcome

I want to change the line which starts with "Hi" to "Hi Every body".

This is the code in c# desktop App:

void changeLine(TextBox RTB, int line, string text)
{
int s1 = RTB.GetFirstCharIndexFromLine(line);
int s2 = line < RTB.Lines.Count() - 1 ?
RTB.GetFirstCharIndexFromLine(line + 1) - 1 :
RTB.Text.Length;
RTB.Select(s1, s2 - s1);
RTB.SelectedText = text;
}
Then i call the Function like this:
int linenumber = TextBox1.GetLineFromCharIndex(TextBox1.Text.IndexOf("Hi: "));

changeLine(TextBox1, linenumber, "Hi Every body");

This works only in c# desktop App. I want to use some thing like this in ASP.NET C#

Rekommenderade kompetenser

Topp bidrag från den här tävlingen

Visa fler bidag

Klargörandetavla

  • kamran211
    kamran211
    • 6 år sedan

    Obviously the code won't work as TextBox for web is not a RichTextBox control. So definitely you won't be able to detect which text has user selected in the textbox.
    Please let me know if you are open to use Javascript to achieve this functionality.

    • 6 år sedan
    1. waelit
      Tävlingsinnehavare
      • 6 år sedan

      Hello Kerman. it cant be by c#?

      • 6 år sedan

Hur du kommer igång med tävlingar

  • Lägg upp din tävling

    Lägg upp din tävling Snabbt och enkelt

  • Få massvis med bidrag

    Få massvis med bidrag Från världens alla hörn

  • Utse det bästa bidraget

    Utse det bästa bidraget Ladda ner filerna - enkelt!

Lägg upp en tävling nu eller gå med idag!