【VB开源代码栏目提醒】:网学会员,鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“tr.frm”一文,供大家参考学习!
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 2670
ClientLeft = 4860
ClientTop = 3945
ClientWidth = 3525
LinkTopic = "Form2"
ScaleHeight = 2670
ScaleWidth = 3525
Begin MSWinsockLib.Winsock r
Left = 1320
Top = 600
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 2400
TabIndex = 3
Top = 2160
Width = 735
End
Begin VB.CommandButton Command2
Caption = "发送"
Height = 375
Left = 1320
TabIndex = 2
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "连接"
Height = 375
Left = 240
TabIndex = 1
Top = 2160
Width = 735
End
Begin
VB.TextBox Text1
Height = 1455
Left = 240
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Top = 120
Width = 3015
End
Begin VB.Label Label1
Caption = "客户端"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 4
Top = 1680
Width = 1215
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'以下是客户机
程序 Private Sub Command1_Click()
MsgBox "本机的计算机名应该与Form_Load()中的 r.RemoteHost 值一致"
'如果状态为0时发出连接命令
If r.State = 0 Then r.Connect
End Sub
Private Sub Command2_Click()
'发送
If r.State <> 0 Then '如果状态不为0时,把文本内容发出
r.SendData Text1.Text '把文本内容发出
Else
MsgBox "请打开连接"
End If
End Sub
Private Sub Command3_Click()
'Unload Form2 '隐蔽客户窗口
End
End Sub
Private Sub Form_Load()
'初绐化
r.RemoteHost = "A" '设置远程
计算机名,控件向它发出数据
r.RemotePort = 100 '设置远程计算机端口号
End Sub