home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / oolregex / vbtest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-08  |  7.0 KB  |  228 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Oolite Regular Expression VB Test"
  4.    ClientHeight    =   3165
  5.    ClientLeft      =   2610
  6.    ClientTop       =   2460
  7.    ClientWidth     =   6510
  8.    Height          =   3630
  9.    Icon            =   "VBTest.frx":0000
  10.    Left            =   2550
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3165
  13.    ScaleWidth      =   6510
  14.    Top             =   2055
  15.    Width           =   6630
  16.    Begin VB.TextBox SubNum 
  17.       Height          =   285
  18.       Left            =   4005
  19.       TabIndex        =   17
  20.       Text            =   "0"
  21.       Top             =   1080
  22.       Width           =   420
  23.    End
  24.    Begin VB.TextBox res4 
  25.       Height          =   285
  26.       Left            =   1800
  27.       TabIndex        =   15
  28.       TabStop         =   0   'False
  29.       Top             =   2520
  30.       Width           =   2655
  31.    End
  32.    Begin VB.TextBox Substitute 
  33.       Height          =   285
  34.       Left            =   1800
  35.       TabIndex        =   3
  36.       Top             =   1080
  37.       Width           =   1455
  38.    End
  39.    Begin VB.TextBox res3 
  40.       Height          =   285
  41.       Left            =   1800
  42.       TabIndex        =   12
  43.       TabStop         =   0   'False
  44.       Top             =   2160
  45.       Width           =   2655
  46.    End
  47.    Begin VB.TextBox res2 
  48.       Height          =   285
  49.       Left            =   1800
  50.       TabIndex        =   10
  51.       TabStop         =   0   'False
  52.       Top             =   1800
  53.       Width           =   2655
  54.    End
  55.    Begin VB.TextBox res1 
  56.       Height          =   285
  57.       Left            =   1800
  58.       TabIndex        =   8
  59.       TabStop         =   0   'False
  60.       Top             =   1440
  61.       Width           =   2655
  62.    End
  63.    Begin VB.TextBox RegExpInput 
  64.       Height          =   285
  65.       Left            =   1800
  66.       TabIndex        =   2
  67.       Text            =   "(ab|a)(b*)c"
  68.       Top             =   720
  69.       Width           =   2655
  70.    End
  71.    Begin VB.CommandButton HelpButton 
  72.       Caption         =   "&Help"
  73.       Height          =   375
  74.       Left            =   4920
  75.       TabIndex        =   6
  76.       Top             =   1320
  77.       Width           =   855
  78.    End
  79.    Begin VB.CommandButton Close 
  80.       Caption         =   "Close"
  81.       Height          =   375
  82.       Left            =   4920
  83.       TabIndex        =   5
  84.       Top             =   840
  85.       Width           =   855
  86.    End
  87.    Begin VB.CommandButton Match 
  88.       Caption         =   "&Match"
  89.       Height          =   375
  90.       Left            =   4920
  91.       TabIndex        =   4
  92.       Top             =   360
  93.       Width           =   855
  94.    End
  95.    Begin VB.TextBox InputString 
  96.       Height          =   285
  97.       Left            =   1800
  98.       TabIndex        =   0
  99.       Text            =   "abc"
  100.       Top             =   360
  101.       Width           =   2655
  102.    End
  103.    Begin VB.Label Label8 
  104.       Caption         =   "SubExp:"
  105.       Height          =   285
  106.       Left            =   3330
  107.       TabIndex        =   18
  108.       Top             =   1125
  109.       Width           =   645
  110.    End
  111.    Begin VB.Label Label7 
  112.       Alignment       =   1  'Right Justify
  113.       Caption         =   "Substitution Result:"
  114.       Height          =   255
  115.       Left            =   120
  116.       TabIndex        =   16
  117.       Top             =   2520
  118.       Width           =   1575
  119.    End
  120.    Begin VB.Label Label6 
  121.       Alignment       =   1  'Right Justify
  122.       Caption         =   "Substitute:"
  123.       Height          =   255
  124.       Left            =   600
  125.       TabIndex        =   14
  126.       Top             =   1080
  127.       Width           =   1095
  128.    End
  129.    Begin VB.Label Label5 
  130.       Alignment       =   1  'Right Justify
  131.       Caption         =   "2nd Sub Match:"
  132.       Height          =   255
  133.       Left            =   120
  134.       TabIndex        =   13
  135.       Top             =   2160
  136.       Width           =   1575
  137.    End
  138.    Begin VB.Label Label4 
  139.       Alignment       =   1  'Right Justify
  140.       Caption         =   "1st Sub Match:"
  141.       Height          =   255
  142.       Left            =   600
  143.       TabIndex        =   11
  144.       Top             =   1800
  145.       Width           =   1095
  146.    End
  147.    Begin VB.Label Label3 
  148.       Alignment       =   1  'Right Justify
  149.       Caption         =   "Full Match:"
  150.       Height          =   255
  151.       Left            =   600
  152.       TabIndex        =   9
  153.       Top             =   1440
  154.       Width           =   1095
  155.    End
  156.    Begin VB.Label Label2 
  157.       Alignment       =   1  'Right Justify
  158.       Caption         =   "Regular Expresion:"
  159.       Height          =   255
  160.       Left            =   120
  161.       TabIndex        =   7
  162.       Top             =   720
  163.       Width           =   1575
  164.    End
  165.    Begin VB.Label Label1 
  166.       Alignment       =   1  'Right Justify
  167.       Caption         =   "Input String:"
  168.       Height          =   255
  169.       Left            =   600
  170.       TabIndex        =   1
  171.       Top             =   360
  172.       Width           =   1095
  173.    End
  174. Attribute VB_Name = "Form1"
  175. Attribute VB_Creatable = False
  176. Attribute VB_Exposed = False
  177. ' Commands to pass WinHelp()
  178. Const HELP_CONTEXT = &H1          '  Display topic in ulTopic
  179. Const HELP_QUIT = &H2             '  Terminate help
  180. Const HELP_INDEX = &H3            '  Display index
  181. Const HELP_CONTENTS = &H3&
  182. Const HELP_HELPONHELP = &H4       '  Display help on using help
  183. Const HELP_SETINDEX = &H5         '  Set current Index for multi index help
  184. Const HELP_SETCONTENTS = &H5&
  185. Const HELP_CONTEXTPOPUP = &H8&
  186. Const HELP_FORCEFILE = &H9&
  187. Const HELP_KEY = &H101            '  Display topic for keyword in offabData
  188. Const HELP_COMMAND = &H102&
  189. Const HELP_PARTIALKEY = &H105&
  190. Const HELP_MULTIKEY = &H201&
  191. Const HELP_SETWINPOS = &H203&
  192. Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
  193. Private Sub Close_Click()
  194.     End
  195. End Sub
  196. Private Sub Command3_Click()
  197. End Sub
  198. Private Sub HelpButton_Click()
  199.     ' Start the Help file
  200.     Dim helpfile As String
  201.     helpfile = "regexp.hlp" & Chr$(0)
  202.     Temp = WinHelp(hwnd, helpfile, HELP_INDEX, 0)
  203. End Sub
  204. Private Sub Match_Click()
  205.    Dim Match As Boolean
  206.    Dim str1 As String, str2 As String, str3 As String, str4 As String
  207.    On Error GoTo ErrorHandler
  208.    Match = RegExp(inputString.Text, RegExpInput.Text, str1, str2, str3)
  209.    Dim subExpNum As Long
  210.    subExpNum = Val(subNum.Text)
  211.    Match = RegSub(inputString.Text, RegExpInput.Text, Substitute.Text, str4, subExpNum)
  212.    res1.Text = str1
  213.    res2.Text = str2
  214.    res3.Text = str3
  215.    res4.Text = str4
  216.    If Match = True Then
  217.     MsgBox "String Matches", vbOKOnly, "Match Result"
  218.    Else
  219.     MsgBox "String does not match.", vbOKOnly, "Match Result"
  220.    End If
  221.     Exit Sub
  222. ErrorHandler:
  223.     If Err.Number <> 0 Then
  224.         Msg = Err.Description
  225.         MsgBox Msg, , "Error", App.helpfile, Err.HelpContext
  226.     End If
  227. End Sub
  228.