HtmlForm コンストラクタとは? わかりやすく解説

HtmlForm コンストラクタ

HtmlForm クラス新しインスタンス初期化します。

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

解説解説
使用例使用例

HtmlForm コントロール新しインスタンス作成して Web ページ配置する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<script runat="server" >
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
         
    ' Create a new HtmlForm control.
    Dim form As HtmlForm = New
 HtmlForm()
    form.ID = "ButtonForm"

    ' Create an HtmlButton control.
    Dim button As HtmlButton = New
 HtmlButton()
    button.InnerHtml = "Click Me"

    ' Register the event-handling method for the ServerClick event of
 the 
    ' HtmlButton control.
    AddHandler button.ServerClick, AddressOf
 Button_Click

    ' Add the HtmlButton control to the HtmlForm control.
    form.Controls.Add(button)

    ' Add the HtmlForm to the control collection of the page.
    Page.Controls.Add(form)
            
  End Sub

  Sub Button_Click(ByVal sender As
 Object, ByVal e As EventArgs)
        
    ' Write a message to the user.
    Message.InnerHtml = "Hello World"

  End Sub
  
</script>

<html>

<head>

  <title>HtmlForm Constructor Example</title>

</head>
  
<body>
  
   <h3> HtmlForm Constructor Example </h3>

   <span id=Message runat="server"/> 

</body>

</html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server" >
  
  void Page_Load(Object sender, EventArgs e)
  {

    // Create a new HtmlForm control.
    HtmlForm form = new HtmlForm();
    form.ID = "ButtonForm";

    // Create an HtmlButton control.
    HtmlButton button = new HtmlButton();
    button.InnerHtml = "Click Me";

    // Register the event-handling method for the ServerClick event
 of the 
    // HtmlButton control.
    button.ServerClick += new System.EventHandler(this.Button_Click);

    // Add the HtmlButton control to the HtmlForm control.
    form.Controls.Add(button);

    // Add the HtmlForm control to the control collection of the page.
    Page.Controls.Add(form);

  }

  void Button_Click(Object sender, EventArgs e)
  {

    // Write a message to the user.
    Message.InnerHtml = "Hello World";

  }
  
</script>

<html>

<head>

   <title>HtmlForm Constructor Example</title>

</head>

<body>
  
   <h3> HtmlForm Constructor Example </h3>

   <span id=Message runat="server"/> 

</body>

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



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

辞書ショートカット

すべての辞書の索引

「HtmlForm コンストラクタ」の関連用語

HtmlForm コンストラクタのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS