TextBox.AutoCompleteType プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TextBox.AutoCompleteType プロパティの意味・解説 

TextBox.AutoCompleteType プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

TextBox コントロールのオートコンプリートの動作を示す値を取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

<ThemeableAttribute(False)> _
Public Overridable Property
 AutoCompleteType As AutoCompleteType
Dim instance As TextBox
Dim value As AutoCompleteType

value = instance.AutoCompleteType

instance.AutoCompleteType = value
[ThemeableAttribute(false)] 
public virtual AutoCompleteType AutoCompleteType { get;
 set; }
[ThemeableAttribute(false)] 
public:
virtual property AutoCompleteType AutoCompleteType {
    AutoCompleteType get ();
    void set (AutoCompleteType value);
}
/** @property */
public AutoCompleteType get_AutoCompleteType ()

/** @property */
public void set_AutoCompleteType (AutoCompleteType
 value)
public function get AutoCompleteType
 () : AutoCompleteType

public function set AutoCompleteType
 (value : AutoCompleteType)

プロパティ値
TextBox コントロールのオートコンプリート動作を示す System.Web.UI.WebControls.AutoCompleteType 列挙値の 1 つ。既定値は None です。

解説解説

データ入力を支援するために、Microsoft Internet Explorer 5 以降および Netscape ではオートコンプリートという機能をサポートしています。オートコンプリートは、テキスト ボックスを監視し、ユーザーが入力した値のリストを作成します。ユーザーが後でテキスト ボックスに戻ると、そのリストが表示されます。ユーザーは、前に入力した値を再入力する代わりに、このリストから値を選択するだけで済みます。TextBox コントロールのオートコンプリート機能の動作を制御するには、AutoCompleteType プロパティを使用します。AutoCompleteType プロパティに適用できる値を表すには、System.Web.UI.WebControls.AutoCompleteType 列挙体が使用されます。

メモメモ

一部のブラウザは、オートコンプリート機能をサポートしていません。使用するブラウザで互換性を確認してください。

既定では、TextBox コントロールの AutoCompleteType プロパティは AutoCompleteType.None に設定されています。この設定では、TextBox コントロールはさまざまなページで同じ ID プロパティを持つ他の TextBox コントロールとリストを共有します。ID プロパティの代わりにカテゴリに基づいて TextBox コントロール間でリストを共有することもできます。AutoCompleteType プロパティをいずれかのカテゴリ値 (AutoCompleteType.FirstName、AutoCompleteType.LastName など) に設定すると、同じカテゴリ値を持つすべての TextBox コントロールが同じリストを共有します。TextBox コントロールのオートコンプリート機能を無効にするには、AutoCompleteType プロパティを AutoCompleteType.Disabled に設定します。

オートコンプリート機能の設定と有効化の詳細については、ブラウザのドキュメントを参照してください。たとえば、Internet Explorer Version 5 以降でオートコンプリート機能を有効にするには、[ツール] メニューの [インターネット オプション] をクリックし、[コンテンツ] タブをクリックします。[オートコンプリート] ボタンをクリックして、オートコンプリート機能のさまざまなブラウザ オプションを表示して変更します。

Internet Explorer のオートコンプリート機能の詳細については、MSDN ライブラリ の「Using AutoComplete in HTML Forms」を参照してください。

このプロパティをテーマ別またはスタイル シート テーマ別に設定することはできません。詳細については、ThemeableAttribute、ASP.NET のテーマとスキンの概要 の各トピックを参照してください。

使用例使用例

AutoCompleteType 列挙体を使用して TextBox コントロールのオートコンプリート カテゴリを指定する方法を次のコード例に示します。

<%@ Page Language="VB" %>
<html>
  <body>
    <form runat="server">
    
      <!-- You need to enable the AutoComplete feature on
 -->
      <!-- a browser that supports it (such as Internet   -->
      <!-- Explorer 5.0 and later) for this
 sample to     -->
      <!-- work. The AutoComplete lists are created after -->
      <!-- the Submit button is clicked.                  -->
    
      <h3>AutoCompleteType example</h3>
    
      Enter values in the text boxes and click
 the Submit <br/>
      button. <br/><br/> 
    
      <!-- The following TextBox controls have different  -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties.                                    -->
      First Name:<br/>
      <asp:textbox id="FirstNameTextBox"
        autocompletetype="FirstName" 
        runat="server"/>
      <br/>
        
      Last Name:<br/>   
      <asp:textbox id="LastNameTextBox"
        autocompletetype="LastName" 
        runat="server"/>
      <br/>
      
      Email:<br/>   
      <asp:textbox id="EmailTextBox"
        autocompletetype="Email" 
        runat="server"/>
      <br/>
      
      <!-- The following TextBox controls have the same   -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties. They share the same AutoComplete   -->
      <!-- list.                                          -->
      Phone Line #1:<br/>
      <asp:textbox id="Phone1TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>
      
      Phone Line #2:<br/>
      <asp:textbox id="Phone2TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>

    
      <!-- The following TextBox control has its          -->
      <!-- AutoCompleteType property set
 to               -->
      <!-- AutoCompleteType.None. All TextBox controls    -->
      <!-- with the same ID across different pages share  -->
      <!-- the same AutoComplete list.                    -->
      Category:<br/>   
      <asp:textbox id="CategoryTextBox"
        autocompletetype="None" 
        runat="server"/>
      <br/>
        
      <!-- The following TextBox control has the          -->
      <!-- AutoComplete feature disabled.                 -->
      Comments:<br/>   
      <asp:textbox id="CommentsTextBox"
        autocompletetype="Disabled" 
        runat="server"/>
      <br/>
      <br/><br/>  
      
      <asp:button id="SubmitButton"
        text="Submit"
        runat="Server"/>
    
    </form>
  </body>
</html>

<%@ Page Language="C#" %>
<html>
  <body>
    <form runat="server">
    
      <!-- You need to enable the AutoComplete feature on -->
      <!-- a browser that supports it (such as Internet   -->
      <!-- Explorer 5.0 and later) for this
 sample to     -->
      <!-- work. The AutoComplete lists are created after -->
      <!-- the Submit button is clicked.                  -->
    
      <h3>AutoCompleteType example</h3>
    
      Enter values in the text boxes and click the Submit <br/>
      button. <br/><br/> 
    
      <!-- The following TextBox controls have different  -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties.                                    -->
      First Name:<br/>
      <asp:textbox id="FirstNameTextBox"
        autocompletetype="FirstName" 
        runat="server"/>
      <br/>
        
      Last Name:<br/>   
      <asp:textbox id="LastNameTextBox"
        autocompletetype="LastName" 
        runat="server"/>
      <br/>
      
      Email:<br/>   
      <asp:textbox id="EmailTextBox"
        autocompletetype="Email" 
        runat="server"/>
      <br/>
      
      <!-- The following TextBox controls have the same   -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties. They share the same AutoComplete   -->
      <!-- list.                                          -->
      Phone Line #1:<br/>
      <asp:textbox id="Phone1TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>
      
      Phone Line #2:<br/>
      <asp:textbox id="Phone2TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>

    
      <!-- The following TextBox control has its          -->
      <!-- AutoCompleteType property set to               -->
      <!-- AutoCompleteType.None. All TextBox controls    -->
      <!-- with the same ID across different pages share  -->
      <!-- the same AutoComplete list.                    -->
      Category:<br/>   
      <asp:textbox id="CategoryTextBox"
        autocompletetype="None" 
        runat="server"/>
      <br/>
        
      <!-- The following TextBox control has the          -->
      <!-- AutoComplete feature disabled.                 -->
      Comments:<br/>   
      <asp:textbox id="CommentsTextBox"
        autocompletetype="Disabled" 
        runat="server"/>
      <br/>
      <br/><br/>  
      
      <asp:button id="SubmitButton"
        text="Submit"
        runat="Server"/>
    
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「TextBox.AutoCompleteType プロパティ」の関連用語

TextBox.AutoCompleteType プロパティのお隣キーワード
検索ランキング

   

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



TextBox.AutoCompleteType プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS