home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 53 / IOPROG_53.ISO / soft / c++ / xceedftp.exe / Samples / Visual Basic / FTPClient / frmConnectionInfo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-10-05  |  7.6 KB  |  208 lines

  1. VERSION 5.00
  2. Begin VB.Form frmConnectionInfo 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Connection information"
  5.    ClientHeight    =   2295
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4170
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2295
  13.    ScaleWidth      =   4170
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   1  'CenterOwner
  16.    Tag             =   "0"
  17.    Begin VB.CommandButton cmdConnect 
  18.       Caption         =   "&Connect"
  19.       Default         =   -1  'True
  20.       Height          =   375
  21.       Left            =   1920
  22.       TabIndex        =   7
  23.       Top             =   1440
  24.       Width           =   975
  25.    End
  26.    Begin VB.CommandButton cmdCancel 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "C&ancel"
  29.       Height          =   375
  30.       Left            =   3000
  31.       TabIndex        =   8
  32.       Top             =   1440
  33.       Width           =   975
  34.    End
  35.    Begin VB.OptionButton optAnonymous 
  36.       Caption         =   "Anonymous"
  37.       Height          =   255
  38.       Left            =   240
  39.       TabIndex        =   4
  40.       Top             =   1800
  41.       Width           =   1215
  42.    End
  43.    Begin VB.OptionButton optNormal 
  44.       Caption         =   "Normal"
  45.       Height          =   255
  46.       Left            =   240
  47.       TabIndex        =   3
  48.       Top             =   1560
  49.       Width           =   1215
  50.    End
  51.    Begin VB.Frame fraLoginType 
  52.       Caption         =   "Login Type"
  53.       Height          =   855
  54.       Left            =   120
  55.       TabIndex        =   12
  56.       Top             =   1320
  57.       Width           =   1695
  58.    End
  59.    Begin VB.TextBox txtPassword 
  60.       Height          =   285
  61.       IMEMode         =   3  'DISABLE
  62.       Left            =   2160
  63.       PasswordChar    =   "*"
  64.       TabIndex        =   6
  65.       Top             =   960
  66.       Width           =   1830
  67.    End
  68.    Begin VB.TextBox txtPort 
  69.       Height          =   285
  70.       Left            =   3360
  71.       TabIndex        =   2
  72.       Text            =   "21"
  73.       Top             =   360
  74.       Width           =   615
  75.    End
  76.    Begin VB.TextBox txtUserName 
  77.       Height          =   285
  78.       Left            =   120
  79.       TabIndex        =   5
  80.       Top             =   960
  81.       Width           =   1830
  82.    End
  83.    Begin VB.TextBox txtHost 
  84.       Height          =   285
  85.       Left            =   120
  86.       TabIndex        =   1
  87.       Top             =   360
  88.       Width           =   3135
  89.    End
  90.    Begin VB.Label lblPassword 
  91.       Caption         =   "Password :"
  92.       Height          =   255
  93.       Left            =   2160
  94.       TabIndex        =   11
  95.       Top             =   720
  96.       Width           =   975
  97.    End
  98.    Begin VB.Label lblPort 
  99.       Caption         =   "Port :"
  100.       Height          =   255
  101.       Left            =   3360
  102.       TabIndex        =   9
  103.       Top             =   120
  104.       Width           =   495
  105.    End
  106.    Begin VB.Label lblUserName 
  107.       Caption         =   "User Name :"
  108.       Height          =   255
  109.       Left            =   120
  110.       TabIndex        =   0
  111.       Top             =   720
  112.       Width           =   1215
  113.    End
  114.    Begin VB.Label lblHost 
  115.       Caption         =   "Host Address : "
  116.       Height          =   255
  117.       Left            =   120
  118.       TabIndex        =   10
  119.       Top             =   120
  120.       Width           =   1215
  121.    End
  122. Attribute VB_Name = "frmConnectionInfo"
  123. Attribute VB_GlobalNameSpace = False
  124. Attribute VB_Creatable = False
  125. Attribute VB_PredeclaredId = True
  126. Attribute VB_Exposed = False
  127. ' Xceed FTP Library - FTP Client sample application
  128. ' Copyright (c) 2000 Xceed Software Inc.
  129. ' [FrmConnectionInfo.frm]
  130. ' This form module contains code for the "Connection Information" dialog box.
  131. ' This file is part of the Xceed FTP Library sample applications. The source
  132. ' code in this file is only intended as a supplement to Xceed FTP Library's
  133. ' documentation, and is provided "as is", without warranty of any kind,
  134. ' either expressed or implied.
  135. Option Explicit
  136. Dim m_bCancelled As Boolean     ' Determines if the "cancel" button has been clicked.
  137. ' ****************************************************************************
  138. ' Display the connection dialog form with the parameter values provided by
  139. ' reference. Change the variables as needed and return True if the user
  140. ' clicked the Connect button or False if the user clicked the Cancel button.
  141. ' ****************************************************************************
  142. Public Function ShowForm(ByRef sAddress As String, ByRef sPort As String, ByRef sUserName As String, ByRef sPassword As String, ByRef bIsAnonymous As Boolean) As Boolean
  143.   ' Set the bCancelled variable to True by default
  144.   m_bCancelled = True
  145.   ' Fill in our connection dialog form's fields from the parameter values
  146.   txtHost.Text = sAddress
  147.   If sPort = "" Then
  148.     txtPort.Text = "21" ' Default port
  149.   Else
  150.     txtPort.Text = sPort
  151.   End If
  152.   txtUserName.Text = sUserName
  153.   txtPassword.Text = sPassword
  154.   If bIsAnonymous Then
  155.     optAnonymous.Value = True
  156.   Else
  157.     optNormal.Value = True
  158.   End If
  159.   ' Display the connection dialog as a modal form
  160.   Call Show(vbModal)
  161.   ' The above call was a blocking call, which means that the form
  162.   ' must have been closed (hidden) and therefore the user has clicked
  163.   ' on either the Connect or the Cancel button. So lets check which
  164.   ' button was pressed:
  165.   If m_bCancelled = False Then  ' The Connect button was clicked.
  166.     ' Lets update the variables passed by reference
  167.     sAddress = Trim$(txtHost.Text)
  168.     sPort = Trim$(txtPort.Text)
  169.     sUserName = Trim$(txtUserName.Text)
  170.     sPassword = Trim$(txtPassword.Text)
  171.     bIsAnonymous = optAnonymous.Value
  172.         
  173.     ShowForm = True ' True return value means Connect button was clicked
  174.   Else
  175.     ShowForm = False ' False return value means Cancel button was clicked
  176.   End If
  177. End Function
  178. ' ****************************************************************************
  179. ' If the cancel button was selected, we do not want to reactivate the controls.
  180. ' ****************************************************************************
  181. Private Sub cmdCancel_Click()
  182.     m_bCancelled = True
  183.     Me.Hide
  184. End Sub
  185. ' ****************************************************************************
  186. ' In this procedure, we will verify the current connection state to make
  187. ' sure that we are not already connected. If we are not connected, we then
  188. ' call the clsFTP class's ConnectToServer procedure, passing the connection
  189. ' information collected by our dialog box. This will connect us to the FTP
  190. ' server.
  191. ' ****************************************************************************
  192. Private Sub cmdConnect_Click()
  193.     m_bCancelled = False
  194.     Me.Hide
  195. End Sub
  196. Private Sub optAnonymous_Click()
  197.   txtUserName.Enabled = False  ' disable username text box
  198.   txtPassword.Enabled = False  ' disable password text box
  199.   txtUserName.BackColor = &H8000000F  ' Set the background color to grey
  200.   txtPassword.BackColor = &H8000000F  ' Set the background color to grey
  201. End Sub
  202. Private Sub optNormal_Click()
  203.   txtUserName.Enabled = True  'enable username text box
  204.   txtPassword.Enabled = True  'enable password text box
  205.   txtUserName.BackColor = &H80000009  'Set the background color to white
  206.   txtPassword.BackColor = &H80000009  'Set the background color to white
  207. End Sub
  208.