PDA

View Full Version : سوال: دسترسی به خطوط متن textbox



سورنا_سردار
دوشنبه 04 اردیبهشت 1396, 00:52 صبح
چطور میشه خطوط تکست باکس رو مدیریت کرد؟؟
مثلا میخوام فقط خط دوم رو بخونم
یا یک مقدار یک عددی رو فقط تو خط سوم تکست باکسم نمایش بدم؟

mmbguide
دوشنبه 04 اردیبهشت 1396, 12:41 عصر
MSDN


// Create a string array and store the contents of the Lines property.
string[] tempArray = textBox1.Lines;


// Loop through the array and send the contents of the array to debug window.
for(int counter=0; counter < tempArray.Length;counter++)
{
System.Diagnostics.Debug.WriteLine(tempArray[counter]);
}



میتونید مستقیما هم خط مورد نظر را رو بخونید:

this.textBox1.Lines[2];