-
Notifications
You must be signed in to change notification settings - Fork 0
/
frm_view_teacher.frm
159 lines (154 loc) · 4.99 KB
/
frm_view_teacher.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frm_view_teacher
BorderStyle = 3 'Fixed Dialog
Caption = "Teacher List"
ClientHeight = 6615
ClientLeft = 45
ClientTop = 390
ClientWidth = 6945
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6615
ScaleWidth = 6945
ShowInTaskbar = 0 'False
Begin VB.ComboBox cmb_dept_name
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1560
Style = 2 'Dropdown List
TabIndex = 0
Top = 240
Width = 5295
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 5175
Left = 120
TabIndex = 1
Top = 1320
Width = 6735
_ExtentX = 11880
_ExtentY = 9128
_Version = 393216
Cols = 3
FixedRows = 0
FixedCols = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label8
Caption = "Department"
BeginProperty Font
Name = "Lucida Handwriting"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "Teacher List"
BeginProperty Font
Name = "Lucida Handwriting"
Size = 12
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 975
Left = 240
TabIndex = 2
Top = 720
Width = 6495
End
End
Attribute VB_Name = "frm_view_teacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmb_dept_name_Click()
MSFlexGrid1.Clear
MSFlexGrid1.RowHeight(0) = 350
MSFlexGrid1.Appearance = flex3D
MSFlexGrid1.BackColorBkg = vbWhite
MSFlexGrid1.FillStyle = flexFillRepeat
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
MSFlexGrid1.RowSel = 0
MSFlexGrid1.ColSel = 2
MSFlexGrid1.BackColorSel = &H80000014
MSFlexGrid1.ForeColorSel = &H80000013
MSFlexGrid1.CellFontBold = True
MSFlexGrid1.CellFontName = "Broadway"
MSFlexGrid1.CellFontSize = 10
MSFlexGrid1.CellFontUnderline = True
MSFlexGrid1.CellTextStyle = flexTextInsetLight
MSFlexGrid1.ColWidth(0) = 1000
MSFlexGrid1.ColWidth(1) = 4000
MSFlexGrid1.ColWidth(2) = 1500
MSFlexGrid1.TextMatrix(0, 0) = "ID"
MSFlexGrid1.TextMatrix(0, 1) = "Name"
MSFlexGrid1.TextMatrix(0, 2) = "Contact"
Call connection
rs.Open "select count(id) from teacher where deptid =(select id from department where name = '" & cmb_dept_name & "')", conn, adOpenDynamic, adLockBatchOptimistic
Dim n As Integer
n = rs.Fields(0)
Call connection
rs.Open "select id,name,contact from teacher where deptid =(select id from department where name = '" & cmb_dept_name & "')", conn, adOpenDynamic, adLockBatchOptimistic
MSFlexGrid1.Rows = n + 1
For i = 1 To n
MSFlexGrid1.TextMatrix(i, 0) = (rs.Fields(0))
MSFlexGrid1.TextMatrix(i, 1) = (rs.Fields(1))
If rs.Fields(2) <> Empty Then
MSFlexGrid1.TextMatrix(i, 2) = (rs.Fields(2))
End If
rs.MoveNext
Next
End Sub
Private Sub Form_Load()
Call connection
rs.Open "select * from department", conn, adOpenDynamic, adLockBatchOptimistic
cmb_dept_name.Clear
While (rs.EOF = False)
cmb_dept_name.AddItem (rs.Fields(1))
rs.MoveNext
Wend
End Sub
Private Sub MSFlexGrid1_EnterCell()
If MSFlexGrid1.Row <> 0 Then
Frm_edit_teacher.Show
Frm_edit_teacher.txt_id.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
Frm_edit_teacher.txt_teacher_name.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
Frm_edit_teacher.cmb_dept_name = cmb_dept_name.Text
Unload Me
End If
End Sub