控件封装问题
Public ip As StringPublic port As String
。。。。。。。。。。。。
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
'
' 本块作用:属性
'
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
'控件状态
'0未连接,1连接,2异常
Public Property Get State() As Integer
Select Case winclient.State
Case 0
State = 0
Case 7
State = 1
Case Else
State = 2
End Select
End Property
'服务器IP地址
Public Property Get ServerIP() As String
ServerIP = winclient.RemoteHost
End Property
Public Property Let ServerIP(ByVal vNewValue As String)
If State = 0 Then winclient.RemoteHost = vNewValue
End Property
'服务器端口
Public Property Get ServerProt() As Long
ServerProt = winclient.RemotePort
End Property
Public Property Let ServerProt(ByVal vNewValue As Long)
If State = 0 Then winclient.RemotePort = vNewValue
End Property
Public Sub start(MDBSTR As String, LOCALPROT As String)
ip = MDBSTR
port = LOCALPROT
' winclient.RemoteHost = ip
' winclient.RemotePort = port
End Sub
'控件自身事件
'-----------------------------------------------------------------------
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
ServerIP = PropBag.ReadProperty("ServerIP", "")
ServerProt = PropBag.ReadProperty("ServerProt", 0)
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "ServerIP", ServerIP, ""
PropBag.WriteProperty "ServerProt", ServerProt, 0
End Sub
Private Sub UserControl_Resize()
UserControl.Width = 40 * 15
UserControl.Height = 40 * 15
End Sub
封装的控件部分内容
新建窗体中调用
Private Sub Form_Load()
netdataclent1.start "127.0.0.1", "8888"
End Sub
ip port 无内容
不知是那里写错了
请高手指教
谢谢