i am using multiline text box control .i want to store first 7 lines.remaining rows are removed string convertion .how to remove morethan one lines using string function.
90,00,000
Pallikaranai
3BHK
Unfurnished
1617
Builder
919884074768
SISDanubewillalwayshaveaspecial'territorialindependence'.
Thenaturalvaluesandlandsaretherealsightsforthepeoplewholongforaquietliving.
Blessedwithabundantwater,SISDanubeoffersaspecialambienceforthosewhowanttoenjoythefeelingoffreedom.
ThisdelightfulapartmentwithlovelypanoramicviewissituatedonVelachery–TambaramRoadnexttoasmallandpeacefulhamlet-Pallikaranai.
Loading
Emiliano MussoPosted Apr 22, 2015, 3:58 AM
Please note that for using Lines, the MultiLine Property of TextBox must be True.
venky nPosted Apr 22, 2015, 3:54 AM
error accured in lines.
String txtText = "";
int index = 0;
foreach (String x in txtAddress.Lines)
{ if (index++ < 7)
txtText += x + Environment.NewLine;
}
venky nPosted Apr 22, 2015, 3:13 AM
protected void cbOLX_CheckedChanged(object sender, EventArgs e)
{
string allstr = txtAddress.Text;
Regex rx = new Regex("\\x20+");
rx = new Regex("(\r\n)+");
string str1 = allstr.Replace("Price per m2:", "").Trim();
str1 = rx.Replace(str1, "\r\n");
string str2 = str1.Replace("Furnished:", "").Trim();
str2 = rx.Replace(str2, "\r\n");
string str3 = str2.Replace("Rooms:", "").Trim();
str3 = rx.Replace(str3, "\r\n");
string str4 = str3.Replace("Square meters:", "").Trim();
str4 = rx.Replace(str4, "\r\n");
txtAddress.Text = str4.Replace(" ", "");
String txtText = "";
txtAddress.Lines.Take
}
Emiliano MussoPosted Apr 22, 2015, 3:12 AM
private void Form1_Load(object sender, EventArgs e)
{
String txtText = "";
textBox1.Lines.Take
MessageBox.Show(txtText);
}
Unpacking the LINQ query to "normal" code, is as if we're writing this:
String txtText = "";
int index = 0;
foreach (String x in textBox1.Lines)
{
if (index++ < 7) txtText += x + Environment.NewLine;
}
venky nPosted Apr 22, 2015, 3:06 AM
Emiliano MussoPosted Apr 22, 2015, 2:47 AM
textBox1.Lines.Take
After that, txtText variable will contain the first 7 lines of text.
Hope this helps.