home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / forms / frmwiz / mainform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-28  |  4.6 KB  |  129 lines

  1. VERSION 2.00
  2. Begin Form MainForm
  3. HelpContextID = 1
  4. BackColor       =   &H00C0C0C0&
  5. Caption         =   "Form Wizard"
  6. ClientHeight    =   600
  7. ClientLeft      =   6315
  8. ClientTop       =   6015
  9. ClientWidth     =   2865
  10. ControlBox      =   0   'False
  11. Height          =   1005
  12. Icon            =   MAINFORM.FRX:0000
  13. Left            =   6255
  14. LinkTopic       =   "Form1"
  15. MaxButton       =   0   'False
  16. ScaleHeight     =   600
  17. ScaleWidth      =   2865
  18. Top             =   5670
  19. Width           =   2985
  20. Begin SSCommand BtnHelp
  21. Caption         =   "&Help"
  22. Font3D          =   2  'Raised w/heavy shading
  23. Height          =   615
  24. Left            =   1920
  25. Picture         =   MAINFORM.FRX:0302
  26. TabIndex        =   2
  27. Top             =   0
  28. Width           =   975
  29. Begin SSCommand BtnExit
  30. Caption         =   "E&xit"
  31. Font3D          =   2  'Raised w/heavy shading
  32. Height          =   615
  33. Left            =   960
  34. Picture         =   MAINFORM.FRX:0604
  35. TabIndex        =   1
  36. Top             =   0
  37. Width           =   975
  38. Begin SSCommand BtnNewForm
  39. Caption         =   "&New Form"
  40. Font3D          =   2  'Raised w/heavy shading
  41. Height          =   615
  42. Left            =   0
  43. Picture         =   MAINFORM.FRX:0906
  44. TabIndex        =   0
  45. Top             =   0
  46. Width           =   975
  47. Option Explicit
  48. Sub BtnExit_Click ()
  49.     Dim AppName$, KeyName$, NewVal$, IniFileName$
  50.     On Error GoTo ExitErr
  51.     EndItNow
  52.     ' Same last position of mainform for next time
  53.     IniFileName$ = "FRMWIZRD.INI"        'name of ini file
  54.     AppName$ = "Form Wizard"             'Name of application or section heading
  55.     KeyName$ = "Left"          'Keyword or variable name
  56.     NewVal$ = Trim$(Str$(MainForm.Left))        'Left pos
  57.     SaveIni AppName$, IniFileName$, KeyName$, NewVal$
  58.     KeyName$ = "Top"          'Keyword or variable name
  59.     NewVal$ = Trim$(Str$(MainForm.Top))        'Top pos
  60.     SaveIni AppName$, IniFileName$, KeyName$, NewVal$
  61.     Cancel3D        ' Cancel the 3-D common dialogs
  62.     End
  63. ExitErr:
  64.     erraction = RB_ErrorHandler("MainForm", "BtnExit_Click")
  65.     Select Case erraction
  66.     Case 1
  67.         Resume 0      ' Retry option selected
  68.     Case 2
  69.         Resume Next   ' Ignore option selected
  70.     End Select
  71. End Sub
  72. Sub BtnHelp_Click ()
  73.     ' TestForm.Show MODELESS
  74.     SendKeys "{F1}"
  75. End Sub
  76. Sub BtnNewForm_Click ()
  77.     EndingIt = False
  78.     RequiredFieldsComplete = "NNNN"      ' Indicate Required Fields not present
  79.     DataForm.Show MODELESS
  80.     MainForm.Hide
  81. End Sub
  82. Sub Form_Load ()
  83.     Dim AppName$, KeyName$, nDefault, Numeric%, DefaultStr$
  84.     Dim IniFileName$, nSize%
  85.     Dim ReturnStr As String      'Create an empty string to be filled
  86.     Dim LastLeft As Long, LastTop As Long
  87.     On Error GoTo Loaderr
  88.     rb_systemname = "RDB Form Wizard"
  89.     rb_version = "1.0"
  90.     quote = """"
  91.     Rem start the 3D dialogs
  92.     Inst% = GetModuleHandle(App.EXEName)  ' Get program's ModuleHandle.
  93.     ret = Ctl3dRegister(Inst%)            ' Register program w/ Ctl3d.
  94.     ret = Ctl3dAutoSubclass(Inst%)        ' Subclass the program.
  95.     NewRecordSource = False
  96.     EndingIt = False
  97.     ' Check INI file to get last position
  98.     IniFileName$ = "FRMWIZRD.INI"        'name of ini file
  99.     AppName$ = "Form Wizard"             'Name of application or section heading
  100.     KeyName$ = "Left"          'Keyword or variable name
  101.     nDefault = 0                   'Default numeric value (for numeric variables)
  102.     DefaultStr$ = "0"  'Default string        (for String variables)
  103.     nSize% = 255                   'uncertain - possibly length of fill string
  104.     Numeric% = False               'Tell it we are looking for a string
  105.     ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr, Numeric%, IniFileName$
  106.     LastLeft = Val(ReturnStr)
  107.     KeyName$ = "Top"          'Keyword or variable name
  108.     nDefault = 0                   'Default numeric value (for numeric variables)
  109.     DefaultStr$ = "0"  'Default string        (for String variables)
  110.     ReturnStr = ""
  111.     nSize% = 255                   'uncertain - possibly length of fill string
  112.     Numeric% = False
  113.     ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr, Numeric%, IniFileName$
  114.     LastTop = Val(ReturnStr)
  115.     If LastLeft > 0 And LastTop > 0 Then
  116.         MainForm.Left = LastLeft
  117.         MainForm.Top = LastTop
  118.     End If
  119.     Exit Sub
  120. Loaderr:
  121.     erraction = RB_ErrorHandler("MainForm", "Form_Load")
  122.     Select Case erraction
  123.     Case 1
  124.         Resume 0      ' Retry option selected
  125.     Case 2
  126.         Resume Next   ' Ignore option selected
  127.     End Select
  128. End Sub
  129.