winforms - Saving Specific line of richTextBox in a Variable C# -
using code line of characters want store in variable
string find = textbox1.text; string linetext = null; int linenum = richtextbox1.getlinefromcharindex(richtextbox1.find(find)); messagebox.show("line number " + linenum);
how can store resulted line text richtextbox in string variable.
you can use lines[] array:
int charnum = richtextbox1.find(find); if (charnum > -1) { linetext = richtextbox1.lines[richtextbox1.getlinefromcharindex(charnum)]; }
Comments
Post a Comment