|
-
Jan 30th, 2001, 06:01 AM
#1
Thread Starter
Hyperactive Member
Is there a simple way of sorting out command buttons for example in order from top to bottom of the screen, in order of their index number or even caption.
If so how?
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Jan 30th, 2001, 06:33 AM
#2
Well ...
What exactly do you mean by 'Sorting Out' the command buttons?
.
-
Jan 30th, 2001, 06:44 AM
#3
Thread Starter
Hyperactive Member
Display them in a certain order Index 0-5 for example from the top to bottom of the screen.
Command 1 index 0
Command 2 index 1
Command 3 index 2
etc
Hope this makes a little more sense
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Jan 30th, 2001, 06:52 AM
#4
Code:
private sub form1_load()
Dim i as integer, i2 as integer
i = 400
for i2 = 0 to 5
cmd(i2).top = i
i = i + 400
next i
end sub
Type of thing? if you set all the names of the command buttons to cmd (and have 6 of them), choosing yes to create a control array, this should work.
-
Jan 30th, 2001, 07:02 AM
#5
Fanatic Member
Same thing but copes with random height buttons:
Code:
Private Sub Form_Load()
Dim lngTop As Long
Dim lngLeft As Long
Dim lngSpace As Long
Dim intLoop As Integer
lngTop = 100 'Top of first button
lngLeft = 100 'Left alignment (all buttons)
lngSpace = 100 'Button spacing
For intLoop = 0 To 5
With Command1(intLoop)
.Caption = "Button " & intLoop
.Move 100, lngTop
lngTop = .Top + .Height + lngSpace
End With
Next intLoop
End Sub
Change the lngTop, lngLeft & lngSpace to suit
-
Jan 30th, 2001, 07:52 AM
#6
Thread Starter
Hyperactive Member
Thanks everyone that sorted, really simple to, I don't know how I missed that one, must be looking to hard
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
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
|