VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4650
   LinkTopic       =   "Form1"
   ScaleHeight     =   2835
   ScaleWidth      =   4650
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   1080
      TabIndex        =   3
      Text            =   "Text3"
      Top             =   1560
      Width           =   3255
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1680
      TabIndex        =   2
      Top             =   2160
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1080
      TabIndex        =   1
      Text            =   "sdf"
      Top             =   960
      Width           =   2055
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Left            =   1080
      TabIndex        =   0
      Text            =   "asdfghjasdfkkhjghj"
      Top             =   240
      Width           =   3015
   End
   Begin VB.Label Label3 
      Caption         =   "删除后的结果"
      Height          =   495
      Left            =   120
      TabIndex        =   6
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "要删除的子串"
      Height          =   495
      Left            =   120
      TabIndex        =   5
      Top             =   960
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "源字符串"
      Height          =   495
      Left            =   0
      TabIndex        =   4
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub DeleStr(s1 As String, ByVal s2 As String)
  Dim i%
  i = InStr(s1, s2)
  ls2 = Len(s2)
  Do While i > 0
    ls1 = Len(s1)
   ' s1 = Left(s1, i - 1) + Right(s1, ls1 - (i + ls2) + 1) ' 在s1中去除s2子字符串
    s1 = Left(s1, i - 1) + Mid(s1, i + ls2)
    i = InStr(s1, s2)
  Loop
End Sub
' 调用DeleStr子过程
Private Sub Command1_Click()
  Dim ss1 As String
  ss1 = Text1
  Call DeleStr(ss1, Text2)
  Text3 = ss1
End Sub

