0% found this document useful (0 votes)
104 views10 pages

Source Code Visual Basic

This document appears to be instructions for a simulation of a queueing system in Visual Basic. It includes code for connecting to a remote host, sending and receiving data, and displaying information like the IP address and hostname. The code has buttons to connect, send data, receive data, disconnect and display information about the connection status and data transfer progress.

Uploaded by

Dendy Nurak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views10 pages

Source Code Visual Basic

This document appears to be instructions for a simulation of a queueing system in Visual Basic. It includes code for connecting to a remote host, sending and receiving data, and displaying information like the IP address and hostname. The code has buttons to connect, send data, receive data, disconnect and display information about the connection status and data transfer progress.

Uploaded by

Dendy Nurak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Tugas 3

Simulasi Sistem Antrian

Nama: Yanuarius Dendy Diktus Nurak

STB : 122285
5
6
Private Sub cmdhostname_Click()
'menampilkan nama host komputer
Dim X As String
X = [Link]
MsgBox X
End Sub

Private Sub cmdIP_Click()


' Menampilkan IP komputer
Dim X As String
X = [Link]
MsgBox X
End Sub

Private Sub Command1_Click()


On Error GoTo ErrHandler

If HostName = vbNullString Then


MsgBox "Enter Remote Host Name First!", vbInformation
Exit Sub
End If

If [Link] = 7 Then
MsgBox "Click Disconnect button first and then connect
", vbExclamation
Exit Sub
End If

' seting IP remote ke server


[Link] = [Link]
'"[Link]"
[Link] = 1001
[Link]

[Link] = False
[Link] = True
[Link] = True

7
ErrHandler:
Exit Sub
End Sub

Private Sub Command2_Click()


Dim a1 As Long, Txt As String, ss As String
If [Link] = 0 Then
MsgBox "Not Conneted", vbExclamation
Exit Sub
End If

If ([Link]) = vbNullString Then


[Link] = "Please Write a Message First"
Else
'[Link] = "Data send"
'End If
'Txt = txtSendData
ss = [Link]
NameSerVer = ss
' [Link] ss & ":" & Space(2) &
txtSendData
[Link] txtSendData
[Link]
' [Link] = "Data send"
End If
End Sub

Private Sub Command4_Click()


txtOutput = vbNullString
End Sub

Private Sub Command6_Click()


If [Link] = 0 Then
MsgBox "First click Connect and then disconnect",
vbExclamation
Exit Sub
End If

[Link]
8
[Link] = True
[Link] = False
[Link] = False
[Link] = "Connection terminated"
End Sub

Private Sub Command7_Click()

End Sub

Private Sub Command8_Click()


If [Link] = 7 Then
[Link] = "Connected to Remote Host"
Else
[Link] = "Not Connected"
End If
Exit Sub
End Sub

Private Sub CommandButton1_Click()


Dim Response As Integer
If [Link] = 7 Then
Response = MsgBox("If you exit your connection to
remote host" & vbCrLf _
& "will be lost. Are you sure to exit(Y/N)", vbYesNo)
If Response = vbYes Then
[Link]
Unload frmClient
Else
Exit Sub
End If
End If
Unload frmClient
End Sub

Private Sub Form_Load()


Left = ([Link] - Width) / 2 ' Center form
horizontally.
Top = ([Link] - Height) / 2 ' Center form
vertically.
9
[Link] = [Link]
End Sub

Private Sub Form_Unload(Cancel As Integer)


Dim Response As Integer, MSG As String
If [Link] = 7 Then
Response = MsgBox("If you exit your connection yo
remote host" & vbCrLf _
& "will be lost. Are you sure to exit(Y/N/C)",
vbQuestion + vbYesNo)
Select Case Response
Case vbNo ' Don't allow close.
Cancel = -1
Exit Sub
MSG = "Connection not terminated."
Case vbYes
[Link]
Unload frmClient
End Select
' Display message if.
End If

End Sub

Private Sub HostName_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then Command1_Click

End Sub

Private Sub mndurasi_Click()


Dim str As String
Dim Rw As Recordset
str = "select * from waktu"
Set Rw = [Link](str)
If [Link] Then
Exit Sub
Else
[Link](2).CommandText = str
[Link] = 2
[Link] 1
10
End If
End Sub

Private Sub mnfclient_Click()


[Link]
End Sub

Private Sub mnkeluar_Click()


Unload Me
End Sub

Private Sub mnreset_Click()


reset_server
End Sub

Private Sub mnsetting_Click()


settings_window.Show
End Sub

Private Sub mntgl_Click()


Dim str As String
Dim Rw As Recordset
str = "select * from nomor order by tanggal"
Set Rw = [Link](str)
If [Link] Then
Exit Sub
Else
[Link](1).CommandText = str
[Link] = 2
[Link] 1
End If
End Sub

Private Sub tcpClient_Close()


[Link] = "Connection not accepted. Now first
click disconnect" & vbCrLf _
& "button inorder to connect to any remote host on
the network"
[Link] = False

11
End Sub

Private Sub tcpClient_DataArrival _


(ByVal bytesTotal As Long)
Dim strData As String
[Link] strData
'[Link] = vbNullString
If [Link] = 1 Then
[Link] = 0
End If
[Link] = strData
[Link] = True
[Link] = "Data Received " & "and " & "Bytes
received: " & bytesTotal
[Link]
End Sub

Private Sub tcpClient_SendProgress(ByVal bytesSent As


Long, _
ByVal bytesRemaining As Long)
[Link] = "Bytes send: " & bytesSent & vbCrLf _
& "Remaning: " & bytesRemaining

End Sub

You might also like