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 -

wpf - C# NAudio - Changing audio playback position still plays a small buffer of old position -

Inno-Setup: use own button texts on messagebox -