home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / VISDATA / VDCLASS.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1997-01-12  |  2.5 KB  |  97 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "VisDataClass"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Attribute VB_Description = "VisData Database Utility"
  11. '>>>>>>>>>>>>>>>>>>>>>>>>
  12. '>>>>>>>>>>>>>>>>>>>>>>>>
  13.  
  14. Public VBInstance As VBIDE.VBE
  15.  
  16. Implements IDTExtensibility
  17.  
  18. '---------------------------------------------------
  19. '╒Γ╕÷╖╜╖¿╙├╫≈┤╙═Γ▓┐╞⌠╢»╡─╙ª╙├│╠╨≥╗≥ VB IDE ╓╨╡─╡≈╙├
  20. '---------------------------------------------------
  21. Private Sub IDTExtensibility_OnConnection(ByVal VBInst As Object, ByVal ConnectMode As vbext_ConnectMode, ByVal AddInInst As VBIDE.AddIn, custom() As Variant)
  22.   On Error GoTo LVDErr
  23.     
  24.   Dim rc As Long
  25.   Set gVDClass = Me
  26.   '╔Φ╓├▒╗ DataFormDesigner ┤░╠σ╩╣╙├╡─ VB ╩╡└²╛Σ▒·
  27.   Set VBInstance = VBInst
  28.   frmMDI.mnuUDataFormDesigner.Visible = True
  29.   frmMDI.WindowState = vbNormal
  30.   
  31.   frmMDI.SetWindowParent
  32.   
  33.   Exit Sub
  34.     
  35. LVDErr:
  36.   MsgBox Err.Description
  37. End Sub
  38.  
  39. Private Sub IDTExtensibility_OnDisconnection(ByVal RemoveMode As vbext_DisconnectMode, custom() As Variant)
  40.   On Error Resume Next
  41.   Unload frmMDI
  42. End Sub
  43.  
  44. Private Sub IDTExtensibility_OnStartupComplete(custom() As Variant)
  45. '
  46. End Sub
  47.  
  48. Private Sub IDTExtensibility_OnAddInsUpdate(custom() As Variant)
  49. '
  50. End Sub
  51.  
  52. '---------------------------------------------------
  53. '╒Γ╕÷╖╜╖¿┐╔╥╘┤╙╚╬║╬ VB ╙ª╙├│╠╨≥╓╨═¿╣² OLE Automation
  54. '╡≈╙├ú¼╚τú║
  55. 'Dim x As Object
  56. 'Set x = CreateObject("VisData.VisDataClass")
  57. 'x.VDOpenDatabase "c:\vb\biblio.mdb", "", False
  58. '---------------------------------------------------
  59. Sub VDOpenDatabase(sDatabaseName As String, sConnect As String, bReadOnly As Integer)
  60.   On Error GoTo RVDErr
  61.     
  62.   frmMDI.mnuUDataFormDesigner.Visible = False
  63.   
  64.   gnReadOnly = bReadOnly
  65.   If Len(sConnect) = 0 Then
  66.     '▒╪╨δ╩╟ Microsoft Access MDB
  67.     gsDataType = gsMSACCESS
  68.     gsDBName = sDatabaseName
  69.     OpenLocalDB True
  70.   ElseIf UCase(Left(sConnect, 5)) = gsSQLDB Then
  71.     '▒╪╨δ╩╟ ODBC ╩²╛▌┐Γ
  72.     gsDataType = gsSQLDB
  73.     '╬¬ ODBC ╔Φ╓├╞Σ╦√▒Σ┴┐
  74.     GetODBCConnectParts sConnect
  75.     gsDBName = sDatabaseName
  76.     SendKeys "%FOO{Enter}"
  77.   Else
  78.     '▒╪╨δ╩╟▒╛╡╪ ISAM ╩²╛▌┐Γ
  79.     gsDataType = sConnect
  80.     gsDBName = sDatabaseName
  81.     OpenLocalDB True
  82.   End If
  83.   
  84.   Exit Sub
  85.     
  86. RVDErr:
  87.   MsgBox Err.Description
  88. End Sub
  89.  
  90. '---------------------------------------------------
  91. '╒Γ╕÷╖╜╖¿┤╙┐═╗º╢╦╣╪▒╒ visdata ┤░╠σ
  92. '---------------------------------------------------
  93. Sub VDClose()
  94.   Unload frmMDI
  95. End Sub
  96.  
  97.