⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mypage.vb

📁 asp.net技术内幕的书配源码
💻 VB
字号:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Public Class myPage
  Inherits Page

  Dim txtTextBox As New TextBox
  Dim lblLabel As New Label

  Protected Overrides Sub CreateChildControls

  ' Add Opening HTML Tags
  Dim strOpenHTML As String
  strOpenHTML = "<html><head><title>My Page</title></head>"
  strOpenHTML &= "<body>Enter some text:"
  Controls.Add( New LiteralControl( strOpenHTML ) )

  ' Add HTMLForm Tag
  Dim frmForm As New HTMLForm
  frmForm.ID = "myForm"
  Controls.Add( frmForm )


  ' Add a TextBox
  txtTextBox.ID = "myTextBox"
  frmForm.Controls.Add( txtTextBox )

  ' Add a Button
  Dim btnButton As New Button
  btnButton.Text = "Click Here!"
  AddHandler btnButton.Click, AddressOf Button_Click
  frmForm.Controls.Add( btnButton )

  ' Add Page Break
  frmForm.Controls.Add( New LiteralControl( "<p>" ) )

  ' Add a Label
  lblLabel.ID = "myLabel"
  frmForm.Controls.Add( lblLabel )

  ' Add Closing HTML Tags
  Dim strCloseHTML As String
  strCloseHTML = "</form></body></html>"
  Controls.Add( New LiteralControl( strCloseHTML ) )

  End Sub

  Sub Button_Click( s As Object, e As EventArgs )
    lblLabel.Text = txtTextBox.Text
  End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -