简体   繁体   中英

How do I insert lines of a external txt file into the domainupdown items in visual c#?

How do I insert lines of a external text file into the domainupdown items in visual c#? each line of text must correspond to a single items.

domainUpDown.Items.Add(line1);
domainUpDown.Items.Add(line2);
domainUpDown.Items.Add(lines n);

ecc

Adapted from: https://www.dotnetperls.com/file-readalllines

string[] lines = File.ReadAllLines("C:\\rearrange.txt");
foreach(var line in lines)
{
   domainUpDown.Items.Add(line);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM