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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -