ComboBox クラスとは? わかりやすく解説

ComboBox クラス

Windows コンボ ボックス コントロール表します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class ComboBox
    Inherits ListControl
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class ComboBox : ListControl
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class ComboBox : public
 ListControl
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class ComboBox extends ListControl
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class ComboBox extends
 ListControl
解説解説

ComboBox には、ListBox編集フィールド組み合わされ表示されユーザーリストから項目を選択したり、新しくテキスト入力したできますComboBox既定動作では、非表示ドロップダウン リスト付いた編集フィールド表示されます。DropDownStyle プロパティは、表示するコンボ ボックススタイル決定します。値を入力することにより、単純なドロップダウン (リストが常に表示される)、ドロップダウン リスト ボックス (テキスト部分編集できず、リスト ボックス表示するには矢印クリックする必要がある)、または既定ドロップダウン リスト ボックス (テキスト部分編集でき、リスト表示するには方向キーを押す必要がある) を設定できますユーザー編集できないリスト表示するには、ListBox コントロール使用します

実行時オブジェクトリスト追加するには、オブジェクト参照配列を AddRange メソッド使用して割り当てます。各オブジェクト既定文字列値がリスト表示されます。Add メソッド使用して個別オブジェクト追加できます

表示機能および選択機能の他に、ComboBox には、ComboBox に項目を効率よく追加したり、リストの項目にあるテキスト検索したりできる機能用意されています。BeginUpdate メソッドと EndUpdate メソッド使用すると、リストに項目を追加するたびにコントロールを再描画せずに、ComboBox多数の項目を追加できます。FindString メソッドおよび FindStringExact メソッド使用すると、特定の検索文字列を含むリスト内の項目を検索できます

リストで現在選択されている項目を管理するには、編集フィールド表示され文字列指定する Text プロパティ選択されている項目を取得または設定する SelectedIndex プロパティ、およびオブジェクトへの参照取得または設定する SelectedItem プロパティ使用します

メモメモ

ListBoxComboBox、または CheckedListBox が配置され基本 Windows フォームページがあり、派生フォームでこれらのコントロール文字列コレクション変更する場合は、基本フォームのこれらのコントロール文字列コレクションを空にする必要があります。これらの文字列コレクションが空でない場合、他のフォーム派生させると、文字列コレクション読み取り専用なります

使用例使用例

ComboBox に項目を追加する Add メソッドComboBox 内の項目を検索する FindString メソッド、および ComboBox多数の項目を効率よく追加する BeginUpdate メソッドEndUpdate メソッド使い方を示す、アプリケーション全体コード例次に示します

Imports System
Imports System.Windows.Forms

Namespace ComboBoxSampleNamespace

    Public Class ComboBoxSample
        Inherits System.Windows.Forms.Form

        Private addButton As System.Windows.Forms.Button
        Private textBox2 As System.Windows.Forms.TextBox
        Private addGrandButton As System.Windows.Forms.Button
        Private comboBox1 As System.Windows.Forms.ComboBox
        Private showSelectedButton As System.Windows.Forms.Button
        Private textBox1 As System.Windows.Forms.TextBox
        Private findButton As System.Windows.Forms.Button
        Private label1 As System.Windows.Forms.Label

        Public Sub New()
            MyBase.New()
            Me.InitializeComponent()
        End Sub

        <System.STAThreadAttribute()> Public Shared
 Sub Main()
            System.Windows.Forms.Application.Run(New ComboBoxSample())
        End Sub

        Private Sub InitializeComponent()
            Me.addButton = New System.Windows.Forms.Button()
            Me.textBox2 = New System.Windows.Forms.TextBox()
            Me.addGrandButton = New System.Windows.Forms.Button()
            Me.comboBox1 = New System.Windows.Forms.ComboBox()
            Me.showSelectedButton = New System.Windows.Forms.Button()
            Me.textBox1 = New System.Windows.Forms.TextBox()
            Me.findButton = New System.Windows.Forms.Button()
            Me.label1 = New System.Windows.Forms.Label()
            Me.addButton.Location = New System.Drawing.Point(248,
 32)
            Me.addButton.Size = New System.Drawing.Size(40,
 24)
            Me.addButton.TabIndex = 1
            Me.addButton.Text = "Add"
            AddHandler Me.addButton.Click,
 AddressOf Me.addButton_Click
            Me.textBox2.Location = New System.Drawing.Point(8,
 64)
            Me.textBox2.Size = New System.Drawing.Size(232,
 20)
            Me.textBox2.TabIndex = 6
            Me.textBox2.Text = ""
            Me.addGrandButton.Location = New
 System.Drawing.Point(8, 96)
            Me.addGrandButton.Size = New System.Drawing.Size(280,
 23)
            Me.addGrandButton.TabIndex = 2
            Me.addGrandButton.Text = "Add 1,000
 Items"
            AddHandler Me.addGrandButton.Click,
 AddressOf Me.addGrandButton_Click
            Me.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom
 Or System.Windows.Forms.AnchorStyles.Left) _
                        Or System.Windows.Forms.AnchorStyles.Right)
            Me.comboBox1.DropDownWidth = 280
            Me.comboBox1.Items.AddRange(New
 Object() {"Item 1", "Item
 2", "Item 3", "Item 4", "Item 5"})
            Me.comboBox1.Location = New System.Drawing.Point(8,
 248)
            Me.comboBox1.Size = New System.Drawing.Size(280,
 21)
            Me.comboBox1.TabIndex = 7
            Me.showSelectedButton.Location = New
 System.Drawing.Point(8, 128)
            Me.showSelectedButton.Size = New
 System.Drawing.Size(280, 24)
            Me.showSelectedButton.TabIndex = 4
            Me.showSelectedButton.Text = "What
 Item is Selected?"
            AddHandler Me.showSelectedButton.Click,
 AddressOf Me.showSelectedButton_Click
            Me.textBox1.Location = New System.Drawing.Point(8,
 32)
            Me.textBox1.Size = New System.Drawing.Size(232,
 20)
            Me.textBox1.TabIndex = 5
            Me.textBox1.Text = ""
            Me.findButton.Location = New System.Drawing.Point(248,
 64)
            Me.findButton.Size = New System.Drawing.Size(40,
 24)
            Me.findButton.TabIndex = 3
            Me.findButton.Text = "Find"
            AddHandler Me.findButton.Click,
 AddressOf Me.findButton_Click
            Me.label1.Location = New System.Drawing.Point(8,
 224)
            Me.label1.Size = New System.Drawing.Size(144,
 23)
            Me.label1.TabIndex = 0
            Me.label1.Text = "Test ComboBox"
            Me.ClientSize = New System.Drawing.Size(292,
 273)
            Me.Controls.AddRange(New System.Windows.Forms.Control()
 {Me.comboBox1, Me.textBox2, Me.textBox1,
 Me.showSelectedButton, Me.findButton, Me.addGrandButton, Me.addButton, Me.label1})
            Me.Text = "ComboBox Sample"
        End Sub

        Private Sub addButton_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
            comboBox1.Items.Add(textBox1.Text)
        End Sub

        Private Sub findButton_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
            Dim index As Integer
            index = comboBox1.FindString(textBox2.Text)
            comboBox1.SelectedIndex = index
        End Sub

        Private Sub addGrandButton_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
            comboBox1.BeginUpdate()
            Dim I As Integer
            For I = 0 To 1000
                comboBox1.Items.Add("Item 1" + i.ToString())
            Next
            comboBox1.EndUpdate()
        End Sub

        Private Sub showSelectedButton_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
            Dim selectedIndex As Integer
            selectedIndex = comboBox1.SelectedIndex
            Dim selectedItem As Object
            selectedItem = comboBox1.SelectedItem

            MessageBox.Show("Selected Item Text: "
 & selectedItem.ToString() & Microsoft.VisualBasic.Constants.vbCrLf &
 _
                                "Index: " & selectedIndex.ToString())
        End Sub
    End Class
End Namespace
using System;
using System.Windows.Forms;

namespace Win32Form1Namespace {
    
    
    public class Win32Form1 : System.Windows.Forms.Form
 {
        private System.Windows.Forms.Button addButton;
        private System.Windows.Forms.TextBox textBox2;
        private System.Windows.Forms.Button addGrandButton;
        private System.Windows.Forms.ComboBox comboBox1;
        private System.Windows.Forms.Button showSelectedButton;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button findButton;
        private System.Windows.Forms.Label label1;
        
        public Win32Form1() {
            this.InitializeComponent();
        }
        
        [System.STAThreadAttribute()]
        public static void
 Main() {
            System.Windows.Forms.Application.Run(new Win32Form1());
        }
        
        private void InitializeComponent()
 {
            this.addButton = new System.Windows.Forms.Button();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.addGrandButton = new System.Windows.Forms.Button();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.showSelectedButton = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.findButton = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.addButton.Location = new System.Drawing.Point(248,
 32);
            this.addButton.Size = new System.Drawing.Size(40,
 24);
            this.addButton.TabIndex = 1;
            this.addButton.Text = "Add";
            this.addButton.Click += new System.EventHandler(this.addButton_Click);
            this.textBox2.Location = new System.Drawing.Point(8,
 64);
            this.textBox2.Size = new System.Drawing.Size(232,
 20);
            this.textBox2.TabIndex = 6;
            this.textBox2.Text = "";
            this.addGrandButton.Location = new
 System.Drawing.Point(8, 96);
            this.addGrandButton.Size = new
 System.Drawing.Size(280, 23);
            this.addGrandButton.TabIndex = 2;
            this.addGrandButton.Text = "Add 1,000 Items";
            this.addGrandButton.Click += new
 System.EventHandler(this.addGrandButton_Click);
            this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom
 | System.Windows.Forms.AnchorStyles.Left) 
                        | System.Windows.Forms.AnchorStyles.Right);
            this.comboBox1.DropDownWidth = 280;
            this.comboBox1.Items.AddRange(new
 object[] {"Item 1",
                        "Item 2",
                        "Item 3",
                        "Item 4",
                        "Item 5"});
            this.comboBox1.Location = new System.Drawing.Point(8,
 248);
            this.comboBox1.Size = new System.Drawing.Size(280,
 21);
            this.comboBox1.TabIndex = 7;
            this.showSelectedButton.Location = new
 System.Drawing.Point(8, 128);
            this.showSelectedButton.Size = new
 System.Drawing.Size(280, 24);
            this.showSelectedButton.TabIndex = 4;
            this.showSelectedButton.Text = "What Item is
 Selected?";
            this.showSelectedButton.Click += new
 System.EventHandler(this.showSelectedButton_Click);
            this.textBox1.Location = new System.Drawing.Point(8,
 32);
            this.textBox1.Size = new System.Drawing.Size(232,
 20);
            this.textBox1.TabIndex = 5;
            this.textBox1.Text = "";
            this.findButton.Location = new
 System.Drawing.Point(248, 64);
            this.findButton.Size = new System.Drawing.Size(40,
 24);
            this.findButton.TabIndex = 3;
            this.findButton.Text = "Find";
            this.findButton.Click += new System.EventHandler(this.findButton_Click);
            this.label1.Location = new System.Drawing.Point(8,
 224);
            this.label1.Size = new System.Drawing.Size(144,
 23);
            this.label1.TabIndex = 0;
            this.label1.Text = "Test ComboBox";
            this.ClientSize = new System.Drawing.Size(292,
 273);
            this.Controls.AddRange(new System.Windows.Forms.Control[]
 {this.comboBox1,
                        this.textBox2,
                        this.textBox1,
                        this.showSelectedButton,
                        this.findButton,
                        this.addGrandButton,
                        this.addButton,
                        this.label1});
            this.Text = "ComboBox Sample";
        }
        
        private void addButton_Click(object
 sender, System.EventArgs e) {
           comboBox1.Items.Add(textBox1.Text);
        }

        private void addGrandButton_Click(object
 sender, System.EventArgs e) {
            comboBox1.BeginUpdate();
            for (int i = 0; i < 1000; i++)
 {
                comboBox1.Items.Add("Item 1" + i.ToString());
            }
            comboBox1.EndUpdate();
        }

        private void findButton_Click(object
 sender, System.EventArgs e) {
            int index = comboBox1.FindString(textBox2.Text);
            comboBox1.SelectedIndex = index;
        }

        private void showSelectedButton_Click(object
 sender, System.EventArgs e) {
            int selectedIndex = comboBox1.SelectedIndex;
            Object selectedItem = comboBox1.SelectedItem;

            MessageBox.Show("Selected Item Text: " + selectedItem.ToString()
 + "\n" +
                            "Index: " + selectedIndex.ToString());
        }
    }
}
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Windows::Forms;

namespace Win32Form1Namespace
{
   public ref class Win32Form1: public
 System::Windows::Forms::Form
   {
   private:
      System::Windows::Forms::Button^ addButton;
      System::Windows::Forms::TextBox^ textBox2;
      System::Windows::Forms::Button^ addGrandButton;
      System::Windows::Forms::ComboBox^ comboBox1;
      System::Windows::Forms::Button^ showSelectedButton;
      System::Windows::Forms::TextBox^ textBox1;
      System::Windows::Forms::Button^ findButton;
      System::Windows::Forms::Label ^ label1;

   public:
      Win32Form1()
      {
         this->InitializeComponent();
      }

   private:
      void InitializeComponent()
      {
         this->addButton = gcnew System::Windows::Forms::Button;
         this->textBox2 = gcnew System::Windows::Forms::TextBox;
         this->addGrandButton = gcnew System::Windows::Forms::Button;
         this->comboBox1 = gcnew System::Windows::Forms::ComboBox;
         this->showSelectedButton = gcnew System::Windows::Forms::Button;
         this->textBox1 = gcnew System::Windows::Forms::TextBox;
         this->findButton = gcnew System::Windows::Forms::Button;
         this->label1 = gcnew System::Windows::Forms::Label;
         this->addButton->Location = System::Drawing::Point(
 248, 32 );
         this->addButton->Size = System::Drawing::Size(
 40, 24 );
         this->addButton->TabIndex = 1;
         this->addButton->Text = "Add";
         this->addButton->Click += gcnew System::EventHandler(
            this, &Win32Form1::addButton_Click );
         this->textBox2->Location = System::Drawing::Point(
 8, 64 );
         this->textBox2->Size = System::Drawing::Size( 232,
 20 );
         this->textBox2->TabIndex = 6;
         this->textBox2->Text = "";
         this->addGrandButton->Location = System::Drawing::Point(
 8, 96 );
         this->addGrandButton->Size = System::Drawing::Size(
 280, 23 );
         this->addGrandButton->TabIndex = 2;
         this->addGrandButton->Text = "Add 1, 000 Items";
         this->addGrandButton->Click += gcnew System::EventHandler(
            this, &Win32Form1::addGrandButton_Click );
         this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)(
            (System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left)
 |
             System::Windows::Forms::AnchorStyles::Right);
         this->comboBox1->DropDownWidth = 280;
         array<Object^>^ objectArray = {"Item 1",
            "Item 2",
            "Item 3",
            "Item 4",
            "Item 5"};
         this->comboBox1->Items->AddRange( objectArray
 );
         this->comboBox1->Location = System::Drawing::Point(
 8, 248 );
         this->comboBox1->Size = System::Drawing::Size(
 280, 21 );
         this->comboBox1->TabIndex = 7;
         this->showSelectedButton->Location = System::Drawing::Point(
 8, 128 );
         this->showSelectedButton->Size = System::Drawing::Size(
 280, 24 );
         this->showSelectedButton->TabIndex = 4;
         this->showSelectedButton->Text = "What Item
 is Selected?";
         this->showSelectedButton->Click += gcnew System::EventHandler(
 
            this, &Win32Form1::showSelectedButton_Click );
         this->textBox1->Location = System::Drawing::Point(
 8, 32 );
         this->textBox1->Size = System::Drawing::Size( 232,
 20 );
         this->textBox1->TabIndex = 5;
         this->textBox1->Text = "";
         this->findButton->Location = System::Drawing::Point(
 248, 64 );
         this->findButton->Size = System::Drawing::Size(
 40, 24 );
         this->findButton->TabIndex = 3;
         this->findButton->Text = "Find";
         this->findButton->Click += gcnew System::EventHandler(
 
            this, &Win32Form1::findButton_Click );
         this->label1->Location = System::Drawing::Point(
 8, 224 );
         this->label1->Size = System::Drawing::Size( 144,
 23 );
         this->label1->TabIndex = 0;
         this->label1->Text = "Test ComboBox";
         this->ClientSize = System::Drawing::Size( 292, 273
 );
         array<System::Windows::Forms::Control^>^ controlsArray = {this->comboBox1
,
            this->textBox2,
            this->textBox1,
            this->showSelectedButton,
            this->findButton,
            this->addGrandButton,
            this->addButton,
            this->label1};
         this->Controls->AddRange( controlsArray );
         this->Text = "ComboBox Sample";
      }

      void addButton_Click( Object^ sender, System::EventArgs^
 e )
      {
         comboBox1->Items->Add( textBox1->Text );
      }

      void addGrandButton_Click( Object^ sender, System::EventArgs^
 e )
      {
         comboBox1->BeginUpdate();
         for ( int i = 0; i < 1000; i++
 )
         {
            comboBox1->Items->Add( "Item 1 " + i.ToString() );

         }
         comboBox1->EndUpdate();
      }

      void findButton_Click( Object^ sender, System::EventArgs^
 e )
      {
         int index = comboBox1->FindString( textBox2->Text
 );
         comboBox1->SelectedIndex = index;
      }

      void showSelectedButton_Click( Object^ sender, System::EventArgs^
 e )
      {
         int selectedIndex = comboBox1->SelectedIndex;
         Object^ selectedItem = comboBox1->SelectedItem;
         MessageBox::Show( "Selected Item Text: " + selectedItem->ToString()
 + "\n" +
            "Index: " + selectedIndex.ToString() );
      }
   };
}


[System::STAThreadAttribute]
int main()
{
   System::Windows::Forms::Application::Run( gcnew Win32Form1Namespace::Win32Form1
 );
}
package Win32Form1Namespace;

import System.*;
import System.Windows.Forms.*;

public class Win32Form1 extends System.Windows.Forms.Form
{
    private System.Windows.Forms.Button addButton;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Button addGrandButton;
    private System.Windows.Forms.ComboBox comboBox1;
    private System.Windows.Forms.Button showSelectedButton;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Button findButton;
    private System.Windows.Forms.Label label1;

    public Win32Form1()
    {
        this.InitializeComponent();
    } //Win32Form1

    /** @attribute System.STAThreadAttribute()
     */
    public static void main(String[]
 args)
    {
        System.Windows.Forms.Application.Run(new Win32Form1());
    } //main
    
    private void InitializeComponent()
    {
        this.addButton = new System.Windows.Forms.Button();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.addGrandButton = new System.Windows.Forms.Button();
        this.comboBox1 = new System.Windows.Forms.ComboBox();
        this.showSelectedButton = new System.Windows.Forms.Button();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.findButton = new System.Windows.Forms.Button();
        this.label1 = new System.Windows.Forms.Label();
        this.addButton.set_Location(new System.Drawing.Point(248,
 32));
        this.addButton.set_Size(new System.Drawing.Size(40,
 24));
        this.addButton.set_TabIndex(1);
        this.addButton.set_Text("Add");
        this.addButton.add_Click(new System.EventHandler(this.addButton_Click));
        this.textBox2.set_Location(new System.Drawing.Point(8,
 64));
        this.textBox2.set_Size(new System.Drawing.Size(232,
 20));
        this.textBox2.set_TabIndex(6);
        this.textBox2.set_Text("");
        this.addGrandButton.set_Location(new
 System.Drawing.Point(8, 96));
        this.addGrandButton.set_Size(new System.Drawing.Size(280,
 23));
        this.addGrandButton.set_TabIndex(2);
        this.addGrandButton.set_Text("Add 1,000 Items");
        this.addGrandButton.add_Click(new System.EventHandler(
            this.addGrandButton_Click));
        this.comboBox1.set_Anchor(System.Windows.Forms.AnchorStyles.Bottom
            | System.Windows.Forms.AnchorStyles.Left
            | System.Windows.Forms.AnchorStyles.Right);
        this.comboBox1.set_DropDownWidth(280);
        this.comboBox1.get_Items().AddRange(new
 Object[] 
            { "Item 1", "Item 2", "Item 3", "Item
 4", "Item 5" });
        this.comboBox1.set_Location(new System.Drawing.Point(8,
 248));
        this.comboBox1.set_Size(new System.Drawing.Size(280,
 21));
        this.comboBox1.set_TabIndex(7);
        this.showSelectedButton.set_Location(new
 System.Drawing.Point(8, 128));
        this.showSelectedButton.set_Size(new
 System.Drawing.Size(280, 24));
        this.showSelectedButton.set_TabIndex(4);
        this.showSelectedButton.set_Text("What Item is Selected?");
        this.showSelectedButton.add_Click(new
 System.EventHandler(
            this.showSelectedButton_Click));
        this.textBox1.set_Location(new System.Drawing.Point(8,
 32));
        this.textBox1.set_Size(new System.Drawing.Size(232,
 20));
        this.textBox1.set_TabIndex(5);
        this.textBox1.set_Text("");
        this.findButton.set_Location(new System.Drawing.Point(248,
 64));
        this.findButton.set_Size(new System.Drawing.Size(40,
 24));
        this.findButton.set_TabIndex(3);
        this.findButton.set_Text("Find");
        this.findButton.add_Click(new System.EventHandler(
            this.findButton_Click));
        this.label1.set_Location(new System.Drawing.Point(8,
 224));
        this.label1.set_Size(new System.Drawing.Size(144,
 23));
        this.label1.set_TabIndex(0);
        this.label1.set_Text("Test ComboBox");
        this.set_ClientSize(new System.Drawing.Size(292,
 273));
        this.get_Controls().AddRange(new System.Windows.Forms.Control[]
            { this.comboBox1, this.textBox2,
 this.textBox1,
            this.showSelectedButton, this.findButton,
 this.addGrandButton,
            this.addButton, this.label1 });
        this.set_Text("ComboBox Sample");
    } //InitializeComponent

    private void addButton_Click(Object sender,
 System.EventArgs e)
    {
        comboBox1.get_Items().Add(textBox1.get_Text());
    } //addButton_Click

    private void addGrandButton_Click(Object
 sender, System.EventArgs e)
    {
        comboBox1.BeginUpdate();
        for (int i = 0; i < 1000; i++) {
            comboBox1.get_Items().Add("Item 1" + ((Int32)i).ToString());
        }
        comboBox1.EndUpdate();
    } //addGrandButton_Click

    private void findButton_Click(Object sender,
 System.EventArgs e)
    {
        int index = comboBox1.FindString(textBox2.get_Text());
        comboBox1.set_SelectedIndex(index);
    } //findButton_Click

    private void showSelectedButton_Click(Object
 sender, System.EventArgs e)
    {
        int selectedIndex = comboBox1.get_SelectedIndex();
        Object selectedItem = comboBox1.get_SelectedItem();
        MessageBox.Show("Selected Item Text: " + selectedItem.ToString()
 
            + "\n" + "Index: " + ((Int32)selectedIndex).ToString());
    } //showSelectedButton_Click
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ListControl
          System.Windows.Forms.ComboBox
             Microsoft.CLRAdmin.DataGridComboBox
             System.Windows.Forms.DataGridViewComboBoxEditingControl
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ComboBox クラス」の関連用語

ComboBox クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ComboBox クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS