home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / helpscr2 / helpscrn.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  4.1 KB  |  137 lines

  1. VERSION 2.00
  2. Begin Form HelpScrn 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Help Screen"
  5.    ClientHeight    =   4200
  6.    ClientLeft      =   975
  7.    ClientTop       =   2100
  8.    ClientWidth     =   7575
  9.    Height          =   4605
  10.    Icon            =   HELPSCRN.FRX:0000
  11.    Left            =   915
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4200
  14.    ScaleWidth      =   7575
  15.    Top             =   1755
  16.    Width           =   7695
  17.    Begin TextBox HoldBox 
  18.       Height          =   285
  19.       Left            =   480
  20.       MultiLine       =   -1  'True
  21.       TabIndex        =   4
  22.       Text            =   "Text1"
  23.       Top             =   240
  24.       Visible         =   0   'False
  25.       Width           =   1095
  26.    End
  27.    Begin ComboBox HelpTopic 
  28.       Height          =   300
  29.       Left            =   3120
  30.       TabIndex        =   0
  31.       Text            =   " "
  32.       Top             =   120
  33.       Width           =   4215
  34.    End
  35.    Begin CommandButton PrintHelp 
  36.       Caption         =   "&Print Topic"
  37.       Height          =   375
  38.       Left            =   5760
  39.       TabIndex        =   2
  40.       Top             =   3720
  41.       Width           =   1575
  42.    End
  43.    Begin CommandButton Return 
  44.       Caption         =   "&Exit Help"
  45.       Height          =   375
  46.       Left            =   240
  47.       TabIndex        =   1
  48.       Top             =   3720
  49.       Width           =   1215
  50.    End
  51.    Begin TextBox DisplayHelp 
  52.       Height          =   3015
  53.       Left            =   240
  54.       MultiLine       =   -1  'True
  55.       ScrollBars      =   2  'Vertical
  56.       TabIndex        =   3
  57.       TabStop         =   0   'False
  58.       Text            =   " "
  59.       Top             =   600
  60.       Width           =   7095
  61.    End
  62. ' Helpscreen is a FREEWARE product.  While it is
  63. ' copywritten, you are encouraged to share it as
  64. ' long as you do not remove this message.
  65. ' HELPSCREEN written by Ed Crygier (C)opyright 1992
  66. ' Requires Visual Basic version 2.0 to incorporate
  67. ' in your program or VBRUN200.DLL to use as a stand
  68. ' alone program.
  69. ' Version 1.1
  70. Const MaxTopics = 100
  71. Const MaxLines = 55
  72. Dim IndexTopic(MaxTopics)
  73. Dim HelpTexT(MaxTopics, MaxLines)
  74. Sub Form_Load ()
  75. 'pass parameter 'HelpItem' to this program to make it text sensitive
  76. NL$ = Chr$(13) + Chr$(10)          'sets a carraige return
  77. TopicNbr = 0                       ' initialize
  78. FileNum = FreeFile                 ' find the next free file
  79. Open "HelpFile.Txt" For Input As FileNum  'the help text
  80. ReadARecord:
  81.  If EOF(FileNum) Then GoTo LeaveHere
  82.    TopicNbr = TopicNbr + 1: LineNbr = 0
  83.    If TopicNbr > MaxTopics Then Close #FileNum: Exit Sub
  84.    Line Input #FileNum, IndexTopic(TopicNbr)
  85.    HelpTopic.AddItem IndexTopic(TopicNbr)
  86. MoreLines:
  87.    LineNbr = LineNbr + 1
  88.    If LineNbr > MaxLines Then
  89.       MsgBox "Number of lines exceeds 55 for Topic " + IndexTopic(TopicNbr) + ".  Add a '#' sign at line 55."
  90.       GoTo ReadARecord
  91.    End If
  92.    Line Input #FileNum, HelpTexT(TopicNbr, LineNbr)
  93.    If LTrim$(Left$(HelpTexT(TopicNbr, LineNbr), 1)) = "#" Then
  94.       GoTo ReadARecord
  95.    Else
  96.     HelpTexT(TopicNbr, LineNbr) = HelpTexT(TopicNbr, LineNbr) + NL$
  97.     GoTo MoreLines
  98.    End If
  99. LeaveHere:
  100. Close #FileNum
  101.  If (Val(HelpItem - 1 >= 0)) And (Val(HelpItem - 1 <= TopicNbr)) Then
  102.     HelpTopic.ListIndex = Str(HelpItem - 1)
  103.  Else
  104.     HelpTopic.ListIndex = 0
  105.  End If
  106. End Sub
  107. Sub HelpTopic_Click ()
  108.  ShowIt
  109. End Sub
  110. Sub PrintHelp_Click ()
  111. X = MsgBox("Insure printer is turned on.  OK to continue?", 36, "Print Topic")
  112. If X = 6 Then
  113.    Printer.Print IndexTopic(HelpTopic.ListIndex + 1)
  114.    Printer.Print DisplayHelp.Text
  115.    Printer.NewPage
  116.    Printer.EndDoc
  117. End If
  118. End Sub
  119. Sub Return_Click ()
  120.  Erase IndexTopic
  121.  Erase HelpTexT
  122.  Unload HelpScrn
  123. End Sub
  124. Sub ShowIt ()
  125. y = HelpTopic.ListIndex + 1
  126. z = 0
  127. DisplayHelp.Text = "": HoldBox.Text = ""
  128. ReadALine:
  129.   z = z + 1
  130.   If LTrim$(Left$(HelpTexT(y, z), 1)) = "#" Then
  131.      DisplayHelp.Text = HoldBox.Text
  132.     Exit Sub
  133.   End If
  134.   HoldBox.Text = HoldBox.Text + HelpTexT(y, z)
  135. GoTo ReadALine
  136. End Sub
  137.