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

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

        C# Listbox 设置选中项

        C# Listbox set selected item(C# Listbox 设置选中项)

        <small id='t4yLj'></small><noframes id='t4yLj'>

          <tbody id='t4yLj'></tbody>
        <legend id='t4yLj'><style id='t4yLj'><dir id='t4yLj'><q id='t4yLj'></q></dir></style></legend>

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

                  <tfoot id='t4yLj'></tfoot>

                1. 本文介绍了C# Listbox 设置选中项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个带有值的 C# 列表框

                  i have a C# listbox with the values

                  Profile 1
                  Profile 2
                  Profile 3
                  

                  我想在表单加载时选择Profile 2.我该怎么做?

                  I want to have Profile 2 selected when the form loads. How do I do this?

                  推荐答案

                  设置ListBox.SelectedIndex 属性.forms.form.shown.aspx" rel="noreferrer">Form.Shown 事件.
                  例如:

                  Set the ListBox.SelectedIndex property in the Form.Shown event.
                  For example:

                  public Form1()
                  {
                      InitializeComponent();
                  
                      // Adding the event handler in the constructor
                      this.Shown += new EventHandler(Form1_Shown);
                  }    
                  
                  private void Form1_Shown(object sender, EventArgs e)
                  {
                      myListBox.SelectedIndex = 1;
                  }
                  

                  这篇关于C# Listbox 设置选中项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 列表框上的取消选择)

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

                            <small id='NN2zg'></small><noframes id='NN2zg'>

                              <tbody id='NN2zg'></tbody>
                            <legend id='NN2zg'><style id='NN2zg'><dir id='NN2zg'><q id='NN2zg'></q></dir></style></legend>