Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
6.4 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmStopWords
  3. BorderStyle = 1 'Fixed Single
  4. Caption = "Edit Stop Words"
  5. ClientHeight = 5910
  6. ClientLeft = 1260
  7. ClientTop = 690
  8. ClientWidth = 7710
  9. LinkTopic = "Form1"
  10. MaxButton = 0 'False
  11. MinButton = 0 'False
  12. ScaleHeight = 5910
  13. ScaleWidth = 7710
  14. Begin VB.Frame fraSeparator
  15. Height = 135
  16. Left = 120
  17. TabIndex = 8
  18. Top = 5160
  19. Width = 7455
  20. End
  21. Begin VB.Frame fraCreate
  22. Caption = "Create new Stop Word"
  23. Height = 1815
  24. Left = 3360
  25. TabIndex = 2
  26. Top = 240
  27. Width = 4215
  28. Begin VB.CommandButton cmdCreate
  29. Caption = "Create"
  30. Height = 375
  31. Left = 2880
  32. TabIndex = 5
  33. Top = 1320
  34. Width = 1215
  35. End
  36. Begin VB.TextBox txtStopWord
  37. Height = 285
  38. Left = 120
  39. TabIndex = 4
  40. Top = 600
  41. Width = 3975
  42. End
  43. Begin VB.Label lblStopWord
  44. Caption = "Stop Word:"
  45. Height = 255
  46. Left = 120
  47. TabIndex = 3
  48. Top = 360
  49. Width = 855
  50. End
  51. End
  52. Begin VB.CommandButton cmdDelete
  53. Caption = "Delete"
  54. Height = 375
  55. Left = 2040
  56. TabIndex = 6
  57. Top = 4680
  58. Width = 1215
  59. End
  60. Begin VB.CommandButton cmdClose
  61. Caption = "Close"
  62. Height = 375
  63. Left = 6360
  64. TabIndex = 7
  65. Top = 5400
  66. Width = 1215
  67. End
  68. Begin VB.ListBox lstAllStopWords
  69. Height = 4155
  70. Left = 120
  71. TabIndex = 1
  72. Top = 360
  73. Width = 3135
  74. End
  75. Begin VB.Label lblAllStopWords
  76. Caption = "All Stop Words:"
  77. Height = 255
  78. Left = 120
  79. TabIndex = 0
  80. Top = 120
  81. Width = 3015
  82. End
  83. End
  84. Attribute VB_Name = "frmStopWords"
  85. Attribute VB_GlobalNameSpace = False
  86. Attribute VB_Creatable = False
  87. Attribute VB_PredeclaredId = True
  88. Attribute VB_Exposed = False
  89. Option Explicit
  90. Private p_clsStopWords As AuthDatabase.StopWords
  91. Private p_rsAllStopWords As ADODB.Recordset
  92. Private Sub Form_Load()
  93. On Error GoTo LErrorHandler
  94. Set p_clsStopWords = g_AuthDatabase.StopWords
  95. Set p_rsAllStopWords = New ADODB.Recordset
  96. p_UpdateAllStopWords
  97. cmdClose.Cancel = True
  98. p_SetToolTips
  99. LEnd:
  100. Exit Sub
  101. LErrorHandler:
  102. p_DisplayErrorMessage "Form_Load"
  103. GoTo LEnd
  104. End Sub
  105. Private Sub Form_Unload(Cancel As Integer)
  106. Set p_clsStopWords = Nothing
  107. Set p_rsAllStopWords = Nothing
  108. End Sub
  109. Private Sub lstAllStopWords_Click()
  110. On Error GoTo LErrorHandler
  111. p_rsAllStopWords.Move lstAllStopWords.ListIndex, adBookmarkFirst
  112. LEnd:
  113. Exit Sub
  114. LErrorHandler:
  115. p_DisplayErrorMessage "lstAllStopWords_Click"
  116. GoTo LEnd
  117. End Sub
  118. Private Sub cmdDelete_Click()
  119. On Error GoTo LErrorHandler
  120. p_clsStopWords.Delete p_rsAllStopWords("SWID"), 0, ""
  121. p_UpdateAllStopWords
  122. LEnd:
  123. Exit Sub
  124. LErrorHandler:
  125. p_DisplayErrorMessage "cmdDelete_Click"
  126. GoTo LEnd
  127. End Sub
  128. Private Sub cmdCreate_Click()
  129. On Error GoTo LErrorHandler
  130. Dim strStopWord As String
  131. strStopWord = LCase$(RemoveExtraSpaces(txtStopWord.Text))
  132. If (strStopWord = "") Then
  133. GoTo LEnd
  134. End If
  135. p_clsStopWords.Create strStopWord
  136. p_UpdateAllStopWords
  137. txtStopWord.Text = ""
  138. txtStopWord.SetFocus
  139. LEnd:
  140. Exit Sub
  141. LErrorHandler:
  142. p_DisplayErrorMessage "cmdCreate_Click"
  143. GoTo LEnd
  144. End Sub
  145. Private Sub cmdClose_Click()
  146. Unload Me
  147. End Sub
  148. Private Sub p_UpdateAllStopWords()
  149. p_clsStopWords.GetAllStopWordsRs p_rsAllStopWords
  150. lstAllStopWords.Clear
  151. Do While (Not p_rsAllStopWords.EOF)
  152. lstAllStopWords.AddItem p_rsAllStopWords("StopWord") & ""
  153. p_rsAllStopWords.MoveNext
  154. Loop
  155. If (lstAllStopWords.ListCount > 0) Then
  156. ' This simulates clicking the list box.
  157. lstAllStopWords.ListIndex = 0
  158. End If
  159. End Sub
  160. Private Sub p_DisplayErrorMessage( _
  161. ByVal i_strFunction As String _
  162. )
  163. Select Case Err.Number
  164. Case errContainsGarbageChar
  165. MsgBox "The Stop Word " & txtStopWord & " contains garbage characters", _
  166. vbExclamation + vbOKOnly
  167. Case errMultiWord
  168. MsgBox "The Stop Word " & txtStopWord & " contains multiple words", _
  169. vbExclamation + vbOKOnly
  170. Case errContainsStopSign
  171. MsgBox "The Stop Word " & txtStopWord & " contains a Stop Sign", _
  172. vbExclamation + vbOKOnly
  173. Case errContainsOperatorShortcut
  174. MsgBox "The Stop Word " & txtStopWord & " contains an operator shortcut", _
  175. vbExclamation + vbOKOnly
  176. Case errContainsVerbalOperator
  177. MsgBox "The Stop Word " & txtStopWord & " is a verbal operator", _
  178. vbExclamation + vbOKOnly
  179. Case errAlreadyExists
  180. MsgBox "The Stop Word " & txtStopWord & " already exists", _
  181. vbExclamation + vbOKOnly
  182. Case E_FAIL
  183. DisplayDatabaseLockedError
  184. Case errDatabaseVersionIncompatible
  185. DisplayDatabaseVersionError
  186. Case errNotPermittedForAuthoringGroup, errAuthoringGroupDiffers, _
  187. errAuthoringGroupNotPresent
  188. DisplayAuthoringGroupError
  189. Case Else
  190. g_ErrorInfo.SetInfoAndDump i_strFunction
  191. End Select
  192. End Sub
  193. Private Sub p_SetToolTips()
  194. lblAllStopWords.ToolTipText = "This is a list of all stop words that have been " & _
  195. "created for this database."
  196. lstAllStopWords.ToolTipText = lblAllStopWords.ToolTipText
  197. txtStopWord.ToolTipText = "Type in a new stop word to add to the list."
  198. End Sub