<bdo id='rdkb1'></bdo><ul id='rdkb1'></ul>
    1. <small id='rdkb1'></small><noframes id='rdkb1'>

      <legend id='rdkb1'><style id='rdkb1'><dir id='rdkb1'><q id='rdkb1'></q></dir></style></legend>
    2. <tfoot id='rdkb1'></tfoot>

      <i id='rdkb1'><tr id='rdkb1'><dt id='rdkb1'><q id='rdkb1'><span id='rdkb1'><b id='rdkb1'><form id='rdkb1'><ins id='rdkb1'></ins><ul id='rdkb1'></ul><sub id='rdkb1'></sub></form><legend id='rdkb1'></legend><bdo id='rdkb1'><pre id='rdkb1'><center id='rdkb1'></center></pre></bdo></b><th id='rdkb1'></th></span></q></dt></tr></i><div id='rdkb1'><tfoot id='rdkb1'></tfoot><dl id='rdkb1'><fieldset id='rdkb1'></fieldset></dl></div>

      将文本文件加载到列表框中

      Loading text file into listbox(将文本文件加载到列表框中)

        <i id='OTvkn'><tr id='OTvkn'><dt id='OTvkn'><q id='OTvkn'><span id='OTvkn'><b id='OTvkn'><form id='OTvkn'><ins id='OTvkn'></ins><ul id='OTvkn'></ul><sub id='OTvkn'></sub></form><legend id='OTvkn'></legend><bdo id='OTvkn'><pre id='OTvkn'><center id='OTvkn'></center></pre></bdo></b><th id='OTvkn'></th></span></q></dt></tr></i><div id='OTvkn'><tfoot id='OTvkn'></tfoot><dl id='OTvkn'><fieldset id='OTvkn'></fieldset></dl></div>

              <tbody id='OTvkn'></tbody>
                <bdo id='OTvkn'></bdo><ul id='OTvkn'></ul>

                <legend id='OTvkn'><style id='OTvkn'><dir id='OTvkn'><q id='OTvkn'></q></dir></style></legend>

                <tfoot id='OTvkn'></tfoot>
              • <small id='OTvkn'></small><noframes id='OTvkn'>

              • 本文介绍了将文本文件加载到列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想要实现的是将文本文件加载到列表框中.看起来很简单,但是当有新行时我需要在文本文件中识别,并且每个新行都需要是列表框中的一个新项目.

                What I am wanting to achieve is loading a text file into a listbox. It seems simple enough but I need to recognise in the text file when there is a new line, and each new line needs to be a new item in the listbox.

                如果可以的话,我们将不胜感激.

                If this is possible, a reply would be much appreciated.

                推荐答案

                这样就可以了

                List<string> lines = new List<string>();
                using (StreamReader r = new StreamReader(f))
                {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        lines.Add(line);
                    }
                }
                

                这篇关于将文本文件加载到列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                Cannot remove items from ListBox(无法从列表框中删除项目)
                Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                  <tbody id='gmBlQ'></tbody>

                  <i id='gmBlQ'><tr id='gmBlQ'><dt id='gmBlQ'><q id='gmBlQ'><span id='gmBlQ'><b id='gmBlQ'><form id='gmBlQ'><ins id='gmBlQ'></ins><ul id='gmBlQ'></ul><sub id='gmBlQ'></sub></form><legend id='gmBlQ'></legend><bdo id='gmBlQ'><pre id='gmBlQ'><center id='gmBlQ'></center></pre></bdo></b><th id='gmBlQ'></th></span></q></dt></tr></i><div id='gmBlQ'><tfoot id='gmBlQ'></tfoot><dl id='gmBlQ'><fieldset id='gmBlQ'></fieldset></dl></div>
                1. <small id='gmBlQ'></small><noframes id='gmBlQ'>

                  <legend id='gmBlQ'><style id='gmBlQ'><dir id='gmBlQ'><q id='gmBlQ'></q></dir></style></legend>
                    <bdo id='gmBlQ'></bdo><ul id='gmBlQ'></ul>
                      <tfoot id='gmBlQ'></tfoot>