c# - How to print a string array on multiple lines within a text box -
i trying print string array muliple lines within texbox.
string[] mexicanrestaurants = { "jose locos 853 n glenstone ave, springfield, mo 65802 (417) 831-1300", "tortilleria perches 1601 w sunshine st, springfield, mo 65807 (417) 864-8195", "purple burrito 5360 s campbell ave springfield, mo 65810 (417) 883-5305", "amigos mexican restaurant 2118 s campbell ave, springfield, mo 65807 (417) 887-1401", "cantina laredo 4109 s national ave, springfield, mo 65807 (417) 881-7200" }; random rand = new random(); string result = mexicanrestaurants[rand.next(mexicanrestaurants.length)]; txtresults.text = result; currently text prints textbox as:
jose locos 853 n glenstone ave, springfield, mo 65802 (417) 831-1300
i trying figue out way print text box like:
jose locos
853 n glenstone ave, springfield, mo 65802
(417) 831-1300
any appreciated. thanks.
it not possible because source data provided in human-readable (not machine-readable) format.
if added delimiter of kind, simple. here way using pipe delimiter.
string[] mexicanrestaurants = {"jose locos|853 n glenstone ave, springfield, mo 65802|(417) 831-1300", "tortilleria perches|1601 w sunshine st, springfield, mo 65807|(417) 864-8195", --etc-- }; random rand = new random(); string result = mexicanrestaurants[rand.next(mexicanrestaurants.length)]; txtresults.lines = result.split("|");
Comments
Post a Comment