TabControl::TabPageCollection::IsReadOnly Property

 

Gets a value indicating whether the collection is read-only.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
property bool IsReadOnly {
	virtual bool get() sealed;
}

Property Value

Type: System::Boolean

This property always returns false.

The following code example creates a TabControl with two TabPage. This example gets the tabControl1 controls collection and determines if it is read-only using the IsReadOnly property.

Use the System.Drawing and System.Windows.Forms namespaces for this example.

using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
public:
   Form1()
   {
      TabControl^ tabControl1 = gcnew TabControl;
      TabPage^ tabPage1 = gcnew TabPage;
      TabPage^ tabPage2 = gcnew TabPage;
      Label^ label1 = gcnew Label;

      // Determines if the tabControl1 controls collection is read-only.
      if ( tabControl1->TabPages->IsReadOnly == true )
            label1->Text = "The tabControl1 controls collection is read-only.";
      else
            label1->Text = "The tabControl1 controls collection is not read-only.";

      array<TabPage^>^tabPages = {tabPage1,tabPage2};
      tabControl1->TabPages->AddRange( tabPages );
      tabControl1->Location = Point(25,75);
      tabControl1->Size = System::Drawing::Size( 250, 200 );
      label1->Location = Point(25,25);
      label1->Size = System::Drawing::Size( 250, 25 );
      this->ClientSize = System::Drawing::Size( 300, 300 );
      array<Control^>^formControls = {tabControl1,label1};
      this->Controls->AddRange( formControls );
   }

};

int main()
{
   Application::Run( gcnew Form1 );
}

.NET Framework
Available since 1.1
Return to top
Show: