|
-
Nov 20th, 2007, 05:11 AM
#1
Thread Starter
New Member
-
Nov 20th, 2007, 05:17 AM
#2
Lively Member
Re: creative minds - ideas encouraged for my project
Here's a grand open source example. Hope it helps you along your way.
Please use the search function prior to posting a question and see if someone's already answered it.
-If I helped you, please rate me, as I'd do the same for you =)
-Remember to select the Resolved option for your post when you've gotten the answers you need.
-
Nov 20th, 2007, 07:06 AM
#3
Re: creative minds - ideas encouraged for my project
here is some basic code to create a display using labels,
put a label on a form about 500 wide by 135 high, somewhere near the left side, give it some colour
either put this into form load or a command button
vb Code:
Dim i as long, w as long, h as long
For i = 1 To Label1.UBound
Unload Label1(i)
Next
w = Label1(0).Width
h = Label1(0).Height
For i = 1 To 69
Load Label1(i)
With Label1(i)
Select Case i Mod 7
Case 0: .Move (Label1(0).Width + 500) * (i \ 7) + Label1(0).Left, Label1(0).Top
Case 1: .Move Label1((i \ 7) * 7).Left + w, Label1(0).Top + h, h, w
Case 2: .Move Label1((i \ 7) * 7).Left + w, Label1(0).Top + 2 * h + w, h, w
Case 3: .Move Label1((i \ 7) * 7).Left, Label1(0).Top + 2 * h + 2 * w
Case 4: .Move Label1((i \ 7) * 7).Left - h, Label1(0).Top + 2 * h + w, h, w
Case 5: .Move Label1((i \ 7) * 7).Left - h, Label1(0).Top + h, h, w
Case 6: .Move Label1((i \ 7) * 7).Left, Label1(0).Top + h + w: .Visible = True
End Select
.Visible = Not .Visible
End With
Next
Label1(0).Visible = True
sw = Me.Width - Me.ScaleWidth
sh = Me.Height - Me.ScaleHeight
Me.Width = (Label1(0).Width + 500) * (i \ 7) + (2 * Label1(0).Left) - s - h * 2
to put a value in the display add a text box, where you can type the number of digits up to the number in the display
vb Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim i As Long, j As Long, mystr As String, x as long
If KeyAscii = 13 Then
KeyAscii = 0
For i = 0 To Label1.UBound
Label1(i).Visible = False
Next
For i = 1 To Len(Text1)
Select Case Mid(Text1, i, 1)
Case 1: mystr = "12"
Case 2: mystr = "01643"
Case 3: mystr = "01236"
Case 4: mystr = "5612"
Case 5: mystr = "05623"
Case 6: mystr = "54326"
Case 7: mystr = "012"
Case 8: mystr = "0123456"
Case 9: mystr = "01256"
Case 0: mystr = "012345"
End Select
For j = 1 To Len(mystr)
x = Mid(mystr, j, 1) + (((i - 1) Mod 7) + ((i - 1) \ 7) * 7) * 7
Label1(x).Visible = True
Next
Next
End If
End Sub
this example creates a 10 digit display, to change the number of digits just change value in for loop from 69, seven digits would be 48
there is no error checking or validation of the text typed in the textbox, and i haven't got round to working from the right hand end or decimal places yet
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 21st, 2007, 06:13 AM
#4
Thread Starter
New Member
Re: creative minds - ideas encouraged for my project
hey thanks for that i'm going to check it out in depth later but looks to be good! cheers.
-
Nov 21st, 2007, 06:14 AM
#5
Thread Starter
New Member
Re: creative minds - ideas encouraged for my project
westconn1,
that code will be VERY helpful. =] many thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|