我有 ASP.NET 页面、它的代码隐藏和一个类文件:
- Folder1/page.aspx(asp.net页面),它包含一个
label
:
<asp:Label runat="server" ID="Label1" Visible="false"></asp:Label>
- Folder1/page.aspx.vb (code-behind),它像这样调用connection.vb:
Dim x As New Connection
Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
x.checkusernameExists(TextBoxUsername.Text)
' I try to access `Boolean variable` Flag from Class file but I can't.
End Sub
- App_Code/connection.vb(我创建的类文件):
Public Class Connection
Public Sub checkusernameExists(ByVal username1 As String)
Dim flag as Boolean
' I try to access here `Label1.text` & `Label1.visible` to work on it but I can't.
End Sub
End Class
我的问题
1 -我如何Label1
从内部ASP.NET page
访问Connection.vb
?
2 -我如何访问Boolean variable
from Connection.vb
inpage.aspx.vb
(code behind) ?
我真的陷入了困境。
谢谢你。