home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / instring / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-04-29  |  2.3 KB  |  86 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3525
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   5175
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3525
  10.    ScaleWidth      =   5175
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox Text2 
  13.       Height          =   495
  14.       Left            =   1680
  15.       TabIndex        =   5
  16.       Text            =   "Find the word the in here"
  17.       Top             =   360
  18.       Width           =   2355
  19.    End
  20.    Begin VB.CommandButton Command2 
  21.       Caption         =   "Close"
  22.       Height          =   495
  23.       Left            =   3360
  24.       TabIndex        =   4
  25.       Top             =   2760
  26.       Width           =   1215
  27.    End
  28.    Begin VB.CommandButton Command1 
  29.       Caption         =   "Find"
  30.       Height          =   495
  31.       Left            =   1800
  32.       TabIndex        =   1
  33.       Top             =   1800
  34.       Width           =   1455
  35.    End
  36.    Begin VB.TextBox Text1 
  37.       Height          =   495
  38.       Left            =   1920
  39.       TabIndex        =   0
  40.       Text            =   "the"
  41.       Top             =   1080
  42.       Width           =   1215
  43.    End
  44.    Begin VB.Label Label2 
  45.       Caption         =   "Main Str"
  46.       Height          =   375
  47.       Left            =   600
  48.       TabIndex        =   3
  49.       Top             =   360
  50.       Width           =   615
  51.    End
  52.    Begin VB.Label Label1 
  53.       Caption         =   "Find str"
  54.       Height          =   375
  55.       Left            =   720
  56.       TabIndex        =   2
  57.       Top             =   1080
  58.       Width           =   615
  59.    End
  60. Attribute VB_Name = "Form1"
  61. Attribute VB_GlobalNameSpace = False
  62. Attribute VB_Creatable = False
  63. Attribute VB_PredeclaredId = True
  64. Attribute VB_Exposed = False
  65. Option Explicit
  66. Dim sublen As Integer, Pos As Integer
  67. Private Sub Command1_Click()
  68. If Len(Text1.Text) = 0 Then
  69. MsgBox "Enter String to be found"
  70. If Len(Text2.Text) = 0 Then
  71. MsgBox "Enter String to be searched in"
  72. sublen = Len(Text1.Text)
  73. Pos = InStr(Text2.Text, Text1.Text)
  74. If (Pos > 0) Then
  75. Text2.SetFocus
  76. Text2.SelStart = Pos - 1
  77. Text2.SelLength = Len(Text1.Text)
  78. MsgBox "String not found"
  79. End If
  80. End If
  81. End If
  82. End Sub
  83. Private Sub Command2_Click()
  84. Unload Me
  85. End Sub
  86.