home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch19code
/
textboxe.frm
< prev
next >
Wrap
Text File
|
1995-08-14
|
5KB
|
170 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2172
ClientLeft = 2592
ClientTop = 1512
ClientWidth = 3636
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 2496
Left = 2544
LinkTopic = "Form1"
ScaleHeight = 2172
ScaleWidth = 3636
Top = 1236
Width = 3732
Begin VB.CommandButton cmdClear
Caption = "Clear All"
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 4
Top = 1680
Width = 2175
End
Begin VB.TextBox Text4
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 615
Left = 2040
TabIndex = 3
Text = "Text4"
Top = 840
Width = 1455
End
Begin VB.TextBox Text3
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 2
Text = "Text3"
Top = 240
Width = 1335
End
Begin VB.TextBox Text2
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 1
Text = "Text2"
Top = 240
Width = 1455
End
Begin VB.TextBox Text1
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 615
Left = 480
TabIndex = 0
Text = "Text1"
Top = 840
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim x(100) As Integer
' Create a new collection to contain all the
' text boxes on a form
Dim colTextBoxes As New TextBoxes
Private Sub Form_Initialize()
' Variable used in For Each to get controls.
Dim cntrlItem As Control
' Loop through the controls on the form.
For Each cntrlItem In Me.Controls
' If the control is a text box, add it to the
' collection of text boxes.
If TypeName(cntrlItem) = "TextBox" Then
colTextBoxes.Add cntrlItem
End If
Next cntrlItem
End Sub
Sub cmdClear_Click()
' Variable used in For Each to get controls.
Dim cntrlItem As Control
' Clear each of the text boxes in the collection.
' This code doesn't work for a type-safe
' collection, since they don't support For Each.
' For Each cntrlItem In colTextBoxes
' cntrlItem.Text = ""
' Next cntrlItem
Dim Index As Integer
For Index = 1 To colTextBoxes.Count
colTextBoxes.Item(Index).Text = ""
Next Index
End Sub
' Minimizes all forms in an application.
Sub MinimizeAll()
Dim frmElement As Form
' For each form in the application.
For Each frmElement In Forms
' Minimize the form.
frmElement.WindowState = vbMinimized
Next frmElement
End Sub
Sub Collection()
Dim clsOut As New Form1
Dim colSelection As New Collection
'clsOut.data = 47
colSelection.Add Form1.Text1
MsgBox TypeName(colSelection)
End Sub