home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
source
/
chap21
/
frm1221.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1995-10-11
|
3KB
|
90 lines
VERSION 4.00
Begin VB.Form frmoutline
Caption = "Form1"
ClientHeight = 5940
ClientLeft = 1140
ClientTop = 1515
ClientWidth = 6690
Height = 6375
Left = 1080
LinkTopic = "Form1"
ScaleHeight = 5940
ScaleWidth = 6690
Top = 1140
Width = 6810
Begin MSOutl.Outline Outline1
Height = 4455
Left = 540
TabIndex = 0
Top = 480
Width = 4575
_version = 65536
_extentx = 8070
_extenty = 7858
_stockprops = 77
mouseicon = "FRM1221.frx":0000
pictureplus = "FRM1221.frx":001C
pictureminus = "FRM1221.frx":018E
pictureleaf = "FRM1221.frx":0300
pictureopen = "FRM1221.frx":0472
pictureclosed = "FRM1221.frx":05E4
End
Attribute VB_Name = "frmoutline"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim ws As Workspace
Dim db As Database
Private Sub Form_Load()
Dim rs As Recordset
Set ws = DBEngine.CreateWorkspace("ws1", "Admin", "")
Set db = ws.OpenDatabase("biblio.mdb", False, False)
Set rs = db.OpenRecordset("Select * from publishers order by name", dbOpenDynaset)
'load the Publishers into the outline control
Do While rs.EOF = False
If Not IsNull(rs("name")) Then
Outline1.AddItem rs("name")
End If
rs.MoveNext
End Sub
Private Sub Outline1_DblClick()
Dim rs As Recordset
Dim rspub As Dynaset
If Outline1.Indent(Outline1.ListIndex) <> 1 Then
Exit Sub
End If
If Outline1.HasSubItems(Outline1.ListIndex) = False Then
Set rspub = db.OpenRecordset("select * from publishers where name ='" & Outline1.List(Outline1.ListIndex) & "'", dbOpenDynaset)
If rspub.RecordCount > 0 Then
Set rs = db.OpenRecordset("select * from titles where pubid = " & rspub("pubid"), dbOpenDynaset)
If rs.RecordCount = 0 Then
Exit Sub
End If
Do While rs.EOF = False
Outline1.AddItem rs("title"), Outline1.ListIndex + 1
Outline1.Indent(Outline1.ListIndex + 1) = 2
rs.MoveNext
Loop
End If
End If
Outline1.Expand(Outline1.ListIndex) = True
End Sub
Private Sub Outline1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13
If Outline1.Expand(Outline1.ListIndex) = False Then
Outline1_DblClick
Else
Outline1.Expand(Outline1.ListIndex) = False
End If
End Select
End Sub