home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Label Edit Form"
- ClientHeight = 3420
- ClientLeft = 60
- ClientTop = 375
- ClientWidth = 4575
- LinkTopic = "Form1"
- ScaleHeight = 3420
- ScaleWidth = 4575
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Stop"
- Height = 495
- Left = 1800
- TabIndex = 3
- Top = 2640
- Width = 1215
- End
- Begin VB.TextBox T1
- BackColor = &H00C0FFFF&
- Height = 285
- Left = 120
- MaxLength = 100
- TabIndex = 2
- Top = 2880
- Width = 1215
- End
- Begin VB.Label L1
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Height = 375
- Index = 4
- Left = 120
- TabIndex = 6
- Top = 2160
- Width = 4335
- WordWrap = -1 'True
- End
- Begin VB.Label L1
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Height = 375
- Index = 3
- Left = 120
- TabIndex = 5
- Top = 1680
- Width = 4335
- WordWrap = -1 'True
- End
- Begin VB.Label L1
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Height = 375
- Index = 2
- Left = 120
- TabIndex = 4
- Top = 1200
- Width = 4335
- WordWrap = -1 'True
- End
- Begin VB.Label L1
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Height = 375
- Index = 1
- Left = 120
- TabIndex = 1
- Top = 720
- UseMnemonic = 0 'False
- Width = 4335
- WordWrap = -1 'True
- End
- Begin VB.Label L1
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Height = 375
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 4335
- WordWrap = -1 'True
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 'Label Editing - 9-16-99
- 'Actually this code seems rather mundane, but it comes in
- 'really handy if you need to assign a lot of text to arrays
- 'for math manipulation then it is too clumsy to do it this
- 'way... arry(1)=val(text1.text)
- ' arry(2)=val(text2.text) etc.
- 'much better doing it with a 'For...Next' loop.
- 'or even only if you have a lot of TextBoxes
- 'There are 2 ways of doing this; with a Text1(x). Array
- 'or with a Label1(x). Array.
- 'The Text1(). Array carries to much baggage because of the
- 'intrinsic editing features. So...
- 'The Label1(). Array only requires 1 TextBox and you'll never
- 'know the difference, except that you cannot TAB to the next
- 'Label.
- 'To create an Array of Labels simply create Label1, copy it
- 'to the Clipboard and reinsert it whereever you want, VB
- 'automatically creates the Label1() Array. Simple
- '<Enter> will advance to the next Label or cycle back to
- 'the first one. You may also choose a label at random by
- 'clicking with your Mouse on it.
- 'Just make sure that you limit text input to fit the label
- 'size by setting the MaxLength variable or set the Label
- 'WordWrap variable to true.
- 'If you have use for it let me know.
- 'Peter Raddatz : lupo@unix.infoserve.net
- Private Sub Form_Load()
- set_t1 0 'position TextBox
- End Sub
- Private Sub L1_Click(x As Integer)
- tx = x
- set_t1 x 'position TextBox
- End Sub
- Private Sub T1_KeyPress(KeyAscii As Integer)
- Select Case KeyAscii
- Case 13
- KeyAscii = 0
- L1(tx) = T1 'copy t1.text to label.caption
- If tx < L1.UBound Then
- tx = tx + 1 'incr. label count
- tx = 0 'or reset to 0
- End If
- set_t1 tx 'position TextBox
- Case 8 'do not print BS char
- Case Else 'anything else show
- End Select
- End Sub
- Private Sub set_t1(nl As Integer)
- T1.Left = L1(nl).Left 'define TextBox Coord.
- T1.Top = L1(nl).Top
- T1.Height = L1(nl).Height
- T1.Width = L1(nl).Width
- T1 = L1(nl) 'copy l1.caption to t1.text
- T1.SelStart = Len(T1) 'put the cursor at the end of text
- End Sub
- Private Sub Command1_Click()
- End Sub
-