www.pudn.com > netserver.zip > frmQuickHttp.frm


VERSION 5.00 
Begin VB.Form frmQuickHttp  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "设置快速网址" 
   ClientHeight    =   3990 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   5415 
   Icon            =   "frmQuickHttp.frx":0000 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   3990 
   ScaleWidth      =   5415 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.CommandButton Command3  
      Caption         =   "更改" 
      Enabled         =   0   'False 
      Height          =   375 
      Left            =   3480 
      TabIndex        =   7 
      Top             =   1080 
      Width           =   975 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "删除" 
      Enabled         =   0   'False 
      Height          =   375 
      Left            =   2280 
      TabIndex        =   6 
      Top             =   1080 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "添加" 
      Enabled         =   0   'False 
      Height          =   375 
      Left            =   1080 
      TabIndex        =   5 
      Top             =   1080 
      Width           =   975 
   End 
   Begin VB.TextBox Text2  
      Height          =   270 
      Left            =   1200 
      TabIndex        =   4 
      Top             =   600 
      Width           =   4095 
   End 
   Begin VB.TextBox Text1  
      Height          =   270 
      Left            =   1200 
      TabIndex        =   3 
      Top             =   120 
      Width           =   4095 
   End 
   Begin VB.ListBox List1  
      Height          =   2400 
      Left            =   0 
      TabIndex        =   0 
      Top             =   1560 
      Width           =   5415 
   End 
   Begin VB.Label Label2  
      Caption         =   "网站地址:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   2 
      Top             =   600 
      Width           =   975 
   End 
   Begin VB.Label Label1  
      Caption         =   "网站名称:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   1 
      Top             =   120 
      Width           =   975 
   End 
End 
Attribute VB_Name = "frmQuickHttp" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
On Error Resume Next 
If UCase(Left(Text2.Text, 7)) <> "HTTP://" Then 
 MsgBox "网址错误!", vbCritical 
 Text2.SetFocus 
 Exit Sub 
End If 
With frmMain.Data10.Recordset 
     .MoveFirst 
     For i = 1 To .RecordCount 
       If .Fields("网站名称") = Text1.Text Then 
        If MsgBox("该网站已经存在了,要将他改成新的吗?", vbYesNo + vbQuestion) = vbYes Then 
        .Edit 
        .Fields("网站名称") = Text1.Text 
        .Fields("网站地址") = Text2.Text 
        .Update 
          
        End If 
        Exit Sub 
       End If 
       .MoveNext 
     Next i 
    .AddNew 
    .Fields("网站名称") = Text1.Text 
    .Fields("网站地址") = Text2.Text 
    .Update 
End With 
List1.Clear 
Form_Load 
End Sub 
 
Private Sub Command2_Click() 
On Error Resume Next 
With frmMain.Data10.Recordset 
.MoveFirst 
.Move List1.ItemData(List1.ListIndex) 
If MsgBox("确实要删除网站:" + .Fields("网站名称") + " 吗?", vbOKCancel + vbQuestion) = vbOK Then 
 .Delete 
End If 
End With 
List1.Clear 
Form_Load 
End Sub 
 
Private Sub Command3_Click() 
On Error Resume Next 
If UCase(Left(Text2.Text, 7)) <> "HTTP://" Then 
 MsgBox "网址错误!", vbCritical 
 Text2.SetFocus 
 Exit Sub 
End If 
With frmMain.Data10.Recordset 
     .MoveFirst 
 .Move List1.ItemData(List1.ListIndex) 
        .Edit 
        .Fields("网站名称") = Text1.Text 
        .Fields("网站地址") = Text2.Text 
        .Update 
 
End With 
List1.Clear 
Form_Load 
End Sub 
 
Private Sub Form_Load() 
On Error Resume Next 
With frmMain.Data10.Recordset 
  .MoveFirst 
  For i = 1 To .RecordCount 
    List1.AddItem .Fields("网站名称") 
    List1.ItemData(List1.NewIndex) = .AbsolutePosition 
   .MoveNext 
  Next i 
End With 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
On Error Resume Next 
Dim aindex As Integer 
For i = 0 To frmMain.Winsock1.Count - 1 
aindex = i 
frmMain.SetQuickHttp aindex 
Next i 
End Sub 
 
Private Sub List1_Click() 
On Error Resume Next 
Command2.Enabled = True 
With frmMain.Data10.Recordset 
.MoveFirst 
.Move List1.ItemData(List1.ListIndex) 
Text1.Text = .Fields("网站名称") 
Text2.Text = .Fields("网站地址") 
End With 
Command1.Enabled = False 
Command3.Enabled = False 
 
End Sub 
 
Private Sub Text1_Change() 
On Error Resume Next 
If Text1.Text = "" Then 
    Command1.Enabled = False 
    Command3.Enabled = False 
Else 
    Command1.Enabled = True 
    Command3.Enabled = True 
End If 
End Sub