home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / SAMPLES / VISDATA / VDCLASS.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1996-10-16  |  2.7 KB  |  101 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "VisDataClass"
  6. Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
  7. Attribute VB_GlobalNameSpace = False
  8. Attribute VB_Creatable = True
  9. Attribute VB_TemplateDerived = False
  10. Attribute VB_PredeclaredId = False
  11. Attribute VB_Exposed = True
  12. Attribute VB_Description = "VisData Database Utility"
  13. '>>>>>>>>>>>>>>>>>>>>>>>>
  14. '>>>>>>>>>>>>>>>>>>>>>>>>
  15.  
  16. Public VBInstance As VBIDE.VBE
  17.  
  18. Implements IDTExtensibility
  19.  
  20. '---------------------------------------------------
  21. 'this method is used as a call from an external
  22. 'launch utility or the VB IDE
  23. '---------------------------------------------------
  24. Private Sub IDTExtensibility_OnConnection(ByVal VBInst As Object, ByVal ConnectMode As vbext_ConnectMode, ByVal AddInInst As VBIDE.AddIn, custom() As Variant)
  25.   On Error GoTo LVDErr
  26.     
  27.   Dim rc As Long
  28.   Set gVDClass = Me
  29.   'this sets the VB instance handle
  30.   'that is used by the DataFormDesigner form
  31.   Set VBInstance = VBInst
  32.   frmMDI.mnuUDataFormDesigner.Visible = True
  33.   frmMDI.WindowState = vbNormal
  34.   
  35.   frmMDI.SetWindowParent
  36.   
  37.   Exit Sub
  38.     
  39. LVDErr:
  40.   MsgBox Err.Description
  41. End Sub
  42.  
  43. Private Sub IDTExtensibility_OnDisconnection(ByVal RemoveMode As vbext_DisconnectMode, custom() As Variant)
  44.   On Error Resume Next
  45.   Unload frmMDI
  46. End Sub
  47.  
  48. Private Sub IDTExtensibility_OnStartupComplete(custom() As Variant)
  49. '
  50. End Sub
  51.  
  52. Private Sub IDTExtensibility_OnAddInsUpdate(custom() As Variant)
  53. '
  54. End Sub
  55.  
  56. '---------------------------------------------------
  57. 'this method can be called from
  58. 'any vb app through OLE automation as in:
  59. 'Dim x As Object
  60. 'Set x = CreateObject("VisData.VisDataClass")
  61. 'x.VDOpenDatabase "c:\vb\biblio.mdb", "", False
  62. '---------------------------------------------------
  63. Sub VDOpenDatabase(sDatabaseName As String, sConnect As String, bReadOnly As Integer)
  64.   On Error GoTo RVDErr
  65.     
  66.   frmMDI.mnuUDataFormDesigner.Visible = False
  67.   
  68.   gnReadOnly = bReadOnly
  69.   If Len(sConnect) = 0 Then
  70.     'must be a Microsoft Access MDB
  71.     gsDataType = gsMSACCESS
  72.     gsDBName = sDatabaseName
  73.     OpenLocalDB True
  74.   ElseIf UCase(Left(sConnect, 5)) = gsSQLDB Then
  75.     'must be an ODBC database
  76.     gsDataType = gsSQLDB
  77.     'set the other variables for ODBC
  78.     GetODBCConnectParts sConnect
  79.     gsDBName = sDatabaseName
  80.     SendKeys "%FOO{Enter}"
  81.   Else
  82.     'must be a local ISAM database
  83.     gsDataType = sConnect
  84.     gsDBName = sDatabaseName
  85.     OpenLocalDB True
  86.   End If
  87.   
  88.   Exit Sub
  89.     
  90. RVDErr:
  91.   MsgBox Err.Description
  92. End Sub
  93.  
  94. '---------------------------------------------------
  95. 'this method simply closes visdata from the client
  96. '---------------------------------------------------
  97. Sub VDClose()
  98.   Unload frmMDI
  99. End Sub
  100.  
  101.