TabControl.TabPageCollection.IndexOf メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As TabPageCollection Dim page As TabPage Dim returnValue As Integer returnValue = instance.IndexOf(page)
戻り値
タブ ページの 0 から始まるインデックス番号。タブ ページが見つからない場合は -1。


1 つの TabPage がある TabControl を作成するコード例を次に示します。この例では、IndexOf メソッドを使用して、tabPage1 のインデックス値を取得しています。ツール ヒントを使用してこの値を表示します。
この例では、System.Drawing 名前空間と System.Windows.Forms 名前空間を使用します。
Imports System.Drawing Imports System.Windows.Forms Public Class Form1 Inherits Form Private tabControl1 As TabControl Private tabPage1 As TabPage Public Sub New() Me.tabControl1 = New TabControl() Me.tabPage1 = New TabPage("myTabPage") Me.tabControl1.Controls.Add(tabPage1) Me.tabControl1.ShowToolTips = True Me.tabControl1.Location = New Point(25, 25) Me.tabControl1.Size = New Size(250, 250) ' Gets the tabPage1 TabIndex value from the tabControl1 controls collection. ' Converts the tabPage1 TabIndex value to a string. Me.tabPage1.ToolTipText = "TabIndex = " + tabControl1.TabPages.IndexOf(tabPage1).ToString() Me.ClientSize = New Size(300, 300) Me.Controls.Add(tabControl1) End Sub Shared Sub Main() Application.Run(New Form1()) End Sub End Class
using System.Drawing; using System.Windows.Forms; public class Form1 : Form { private TabControl tabControl1; private TabPage tabPage1; public Form1() { this.tabControl1 = new TabControl(); this.tabPage1 = new TabPage("myTabPage"); this.tabControl1.TabPages.Add(tabPage1); this.tabControl1.ShowToolTips = true; this.tabControl1.Location = new Point(25, 25); this.tabControl1.Size = new Size(250, 250); this.tabPage1.ToolTipText = "TabIndex = " + // Gets the tabPage1 TabIndex value from the tabControl1 controls collection. // Converts the tabPage1 TabIndex value to a string. (tabControl1.TabPages.IndexOf(tabPage1)).ToString(); this.ClientSize = new Size(300, 300); this.Controls.Add(tabControl1); } static void Main() { Application.Run(new Form1()); } }
using namespace System::Drawing; using namespace System::Windows::Forms; public ref class Form1: public Form { private: TabControl^ tabControl1; TabPage^ tabPage1; public: Form1() { this->tabControl1 = gcnew TabControl; this->tabPage1 = gcnew TabPage( "myTabPage" ); this->tabControl1->TabPages->Add( tabPage1 ); this->tabControl1->ShowToolTips = true; this->tabControl1->Location = Point(25,25); this->tabControl1->Size = System::Drawing::Size( 250, 250 ); this->tabPage1->ToolTipText = System::String::Concat( "TabIndex = ", (tabControl1->TabPages->IndexOf( tabPage1 )).ToString() ); // Gets the tabPage1 TabIndex value from the tabControl1 controls collection. // Converts the tabPage1 TabIndex value to a string. this->ClientSize = System::Drawing::Size( 300, 300 ); this->Controls->Add( tabControl1 ); } }; int main() { Application::Run( gcnew Form1 ); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTabControl.TabPageCollection.IndexOf メソッドを検索する場合は、下記のリンクをクリックしてください。

- TabControl.TabPageCollection.IndexOf メソッドのページへのリンク