<bdo id='gAqT1'></bdo><ul id='gAqT1'></ul>

    1. <small id='gAqT1'></small><noframes id='gAqT1'>

      <i id='gAqT1'><tr id='gAqT1'><dt id='gAqT1'><q id='gAqT1'><span id='gAqT1'><b id='gAqT1'><form id='gAqT1'><ins id='gAqT1'></ins><ul id='gAqT1'></ul><sub id='gAqT1'></sub></form><legend id='gAqT1'></legend><bdo id='gAqT1'><pre id='gAqT1'><center id='gAqT1'></center></pre></bdo></b><th id='gAqT1'></th></span></q></dt></tr></i><div id='gAqT1'><tfoot id='gAqT1'></tfoot><dl id='gAqT1'><fieldset id='gAqT1'></fieldset></dl></div>
      1. <legend id='gAqT1'><style id='gAqT1'><dir id='gAqT1'><q id='gAqT1'></q></dir></style></legend>
      2. <tfoot id='gAqT1'></tfoot>

        列表框选择的项目给我&quot;System.Data.DataRowView", C# Winfor

        时间:2023-10-08
        • <bdo id='pSKVJ'></bdo><ul id='pSKVJ'></ul>
          <i id='pSKVJ'><tr id='pSKVJ'><dt id='pSKVJ'><q id='pSKVJ'><span id='pSKVJ'><b id='pSKVJ'><form id='pSKVJ'><ins id='pSKVJ'></ins><ul id='pSKVJ'></ul><sub id='pSKVJ'></sub></form><legend id='pSKVJ'></legend><bdo id='pSKVJ'><pre id='pSKVJ'><center id='pSKVJ'></center></pre></bdo></b><th id='pSKVJ'></th></span></q></dt></tr></i><div id='pSKVJ'><tfoot id='pSKVJ'></tfoot><dl id='pSKVJ'><fieldset id='pSKVJ'></fieldset></dl></div>
            <legend id='pSKVJ'><style id='pSKVJ'><dir id='pSKVJ'><q id='pSKVJ'></q></dir></style></legend>

                  <tbody id='pSKVJ'></tbody>

                1. <small id='pSKVJ'></small><noframes id='pSKVJ'>

                  <tfoot id='pSKVJ'></tfoot>
                  本文介绍了列表框选择的项目给我&quot;System.Data.DataRowView", C# Winforms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有 listbox1 - 它的数据源是一列(产品名称).

                  I have listbox1 - its datasource is a column (productname).

                  所以我在列表框中有一个 MultiSelection 选项.

                  so i have in the listbox a MultiSelection option.

                  我正在尝试为我选择的所有选项制作一个 MessageBox 代码:

                  and im trying to make a MessageBox for all the option i selected and this the code:

                    foreach (object selectedItem in listBox1.SelectedItems)
                    {
                         MessageBox.Show((selectedItem.ToString() + Environment.NewLine));
                     }
                  

                  问题是我得到了这个值System.Data.DataRowView

                  推荐答案

                  如何填充列表框(即数据源到底是什么)?

                  How do you populate the listbox (ie what is exactly the datasource)?

                  根据您的评论,我会说一个 DataView(其中包含 DataRowView...)

                  From your comment I would say a DataView (and wich contains DataRowView...)

                  因此,您只需要将 SelectedItem 转换为 DataRowView 即可从此 DataRowView 中获取值:

                  So you just need to cast the SelectedItem into DataRowView in order to get a value from this DataRowView:

                  foreach (object selectedItem in listBox1.SelectedItems)
                  {
                       DataRowView dr = (DataRowView)selectedItem;
                       String result = dr["productname"].ToString;
                       MessageBox.Show(result + Environment.NewLine);
                  }
                  

                  可能会关注这篇文章的 VB.Net 开发人员也可能对这个感兴趣.

                  The VB.Net developers that could fall on this post could also be interested in this.

                  这篇关于列表框选择的项目给我&quot;System.Data.DataRowView", C# Winforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:无法从列表框中删除项目 下一篇:在另一个线程(winforms)上使用 IEnumrable 填充 ListBox

                  相关文章

                  <tfoot id='6eV14'></tfoot>

                  <small id='6eV14'></small><noframes id='6eV14'>

                  <legend id='6eV14'><style id='6eV14'><dir id='6eV14'><q id='6eV14'></q></dir></style></legend>
                      <bdo id='6eV14'></bdo><ul id='6eV14'></ul>

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