Re: [.NET] web user control彼此傳值

看板Visual_Basic作者 (Linka)時間18年前 (2007/03/09 21:56), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
這是我練習時寫的 利用 Property Get & Set 取得 & 設定 UserControl 的屬性 n 以下範例: 一個 Label、一個 TextBox、一個 Button、一個 Calendar 使用的 Web Form 取值可用:Date_Selector1.SelectedDateValue Partial Class Date_Selector Inherits System.Web.UI.UserControl Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged TextBox1.Text = Calendar1.SelectedDate Calendar1.Visible = False End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Calendar1.Visible = True End Sub Public ReadOnly Property SelectedDateValue() As String Get Return TextBox1.Text End Get End Property Public Property Date_SelectorTitle() As String Get Return Label1.Text End Get Set(ByVal value As String) Label1.Text = value End Set End Property End Class -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.231.77.199 ※ 編輯: mathlinka 來自: 61.231.77.199 (03/09 22:00)
文章代碼(AID): #15yMUf4U (Visual_Basic)
文章代碼(AID): #15yMUf4U (Visual_Basic)