Control.Parent
例如:Private Sub Button1_Click(sender As Object, MyEventArgs As EventArgs)
' Find control on page.
Dim myControl1 As Control = FindControl("TextBox2")
If (Not myControl1 Is Nothing)
' Get control's parent.
Dim myControl2 As Control = myControl1.Parent
Response.Write("Parent of the text box is : " & myControl2.ID)
Else
Response.Write("Control not found.....")
End If
End Sub
例如:Private Sub Button1_Click(sender As Object, MyEventArgs As EventArgs)
' Find control on page.
Dim myControl1 As Control = FindControl("TextBox2")
If (Not myControl1 Is Nothing)
' Get control's parent.
Dim myControl2 As Control = myControl1.Parent
Response.Write("Parent of the text box is : " & myControl2.ID)
Else
Response.Write("Control not found.....")
End If
End Sub
為什麼在vb.net(winform)中敲"control.p"不會自動顯示其parent屬性?
真是沒想到,害我瞎忙了這麼久。