home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP23 / Client2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-03-07  |  5.5 KB  |  183 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form Client2 
  4.    BackColor       =   &H00000000&
  5.    Caption         =   "Price Lookup"
  6.    ClientHeight    =   4275
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   6300
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   4275
  12.    ScaleWidth      =   6300
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.TextBox txtItem 
  15.       BackColor       =   &H00FFFFFF&
  16.       Height          =   285
  17.       Left            =   1800
  18.       TabIndex        =   5
  19.       Top             =   1080
  20.       Width           =   1215
  21.    End
  22.    Begin VB.Frame Frame1 
  23.       BackColor       =   &H00000000&
  24.       Height          =   735
  25.       Left            =   0
  26.       TabIndex        =   0
  27.       Top             =   3480
  28.       Width           =   6255
  29.       Begin VB.CommandButton cmdConnect 
  30.          Caption         =   "Connect"
  31.          Height          =   375
  32.          Left            =   3120
  33.          TabIndex        =   8
  34.          Top             =   240
  35.          Width           =   1455
  36.       End
  37.       Begin MSWinsockLib.Winsock Winsock1 
  38.          Left            =   2280
  39.          Top             =   240
  40.          _ExtentX        =   741
  41.          _ExtentY        =   741
  42.          _Version        =   393216
  43.       End
  44.       Begin VB.CommandButton cmdClose 
  45.          Caption         =   "Close"
  46.          Height          =   375
  47.          Left            =   4680
  48.          TabIndex        =   2
  49.          Top             =   240
  50.          Width           =   1455
  51.       End
  52.       Begin VB.CommandButton cmdSend 
  53.          BackColor       =   &H00000000&
  54.          Caption         =   "Lookup"
  55.          Height          =   375
  56.          Left            =   120
  57.          Picture         =   "Client2.frx":0000
  58.          TabIndex        =   1
  59.          Top             =   240
  60.          Width           =   1455
  61.       End
  62.    End
  63.    Begin VB.Label lblPrice 
  64.       BorderStyle     =   1  'Fixed Single
  65.       Height          =   285
  66.       Left            =   1800
  67.       TabIndex        =   7
  68.       Top             =   1560
  69.       Width           =   1215
  70.    End
  71.    Begin VB.Label lblMessage 
  72.       BackColor       =   &H80000008&
  73.       ForeColor       =   &H00C00000&
  74.       Height          =   255
  75.       Left            =   240
  76.       TabIndex        =   6
  77.       Top             =   120
  78.       Width           =   2535
  79.    End
  80.    Begin VB.Line Line4 
  81.       BorderColor     =   &H00808080&
  82.       X1              =   0
  83.       X2              =   6240
  84.       Y1              =   480
  85.       Y2              =   480
  86.    End
  87.    Begin VB.Shape shpWait 
  88.       BackColor       =   &H0000FFFF&
  89.       BackStyle       =   1  'Opaque
  90.       Height          =   135
  91.       Left            =   5760
  92.       Shape           =   3  'Circle
  93.       Top             =   120
  94.       Visible         =   0   'False
  95.       Width           =   255
  96.    End
  97.    Begin VB.Shape shpGo 
  98.       BackColor       =   &H00808000&
  99.       BackStyle       =   1  'Opaque
  100.       Height          =   135
  101.       Left            =   5520
  102.       Shape           =   3  'Circle
  103.       Top             =   120
  104.       Visible         =   0   'False
  105.       Width           =   255
  106.    End
  107.    Begin VB.Shape shpError 
  108.       BackColor       =   &H000000FF&
  109.       BackStyle       =   1  'Opaque
  110.       Height          =   135
  111.       Left            =   6000
  112.       Shape           =   3  'Circle
  113.       Top             =   120
  114.       Visible         =   0   'False
  115.       Width           =   135
  116.    End
  117.    Begin VB.Label LblLKPrice 
  118.       BackStyle       =   0  'Transparent
  119.       Caption         =   "Price"
  120.       ForeColor       =   &H0000FFFF&
  121.       Height          =   255
  122.       Left            =   480
  123.       TabIndex        =   4
  124.       Top             =   1560
  125.       Width           =   735
  126.    End
  127.    Begin VB.Label lblItem 
  128.       BackStyle       =   0  'Transparent
  129.       Caption         =   "Item Number"
  130.       ForeColor       =   &H0000FFFF&
  131.       Height          =   255
  132.       Left            =   480
  133.       TabIndex        =   3
  134.       Top             =   1080
  135.       Width           =   1095
  136.    End
  137. Attribute VB_Name = "Client2"
  138. Attribute VB_GlobalNameSpace = False
  139. Attribute VB_Creatable = False
  140. Attribute VB_PredeclaredId = True
  141. Attribute VB_Exposed = False
  142. Option Explicit
  143. Private Sub cmdClose_Click()
  144.      Winsock1.Close
  145.      shpGo.Visible = False
  146.      shpWait.Visible = False
  147.      shpError.Visible = True
  148. End Sub
  149. Private Sub cmdConnect_Click()
  150.     Winsock1.RemoteHost = "127.0.0.1"
  151.     Winsock1.RemotePort = 1007
  152.     Winsock1.Connect
  153.     shpGo.Visible = True
  154.     txtItem.SetFocus
  155. End Sub
  156. Private Sub cmdSend_Click()
  157.  If Winsock1.State = sckConnected Then
  158.         Winsock1.SendData txtItem.Text
  159.         shpGo.Visible = True
  160.         lblMessage.Caption = "Sending Data"
  161.     Else
  162.         shpGo.Visible = False
  163.         shpWait.Visible = False
  164.         shpError.Visible = True
  165.         lblMessage.Caption = "Not currently connected to host"
  166.     End If
  167. End Sub
  168. Private Sub Form_Load()
  169. End Sub
  170. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  171.     Dim sData As String
  172.     Winsock1.GetData sData, vbString
  173.     lblPrice.Caption = sData
  174.     lblMessage.Caption = "Received data"
  175.     shpGo.Visible = True
  176.     shpWait.Visible = False
  177.     shpError.Visible = False
  178.      
  179. End Sub
  180. Private Sub Winsock1_SendComplete()
  181.     lblMessage.Caption = "Completed Data Transmission"
  182. End Sub
  183.