|
-
Oct 13th, 2004, 02:18 AM
#1
Thread Starter
Addicted Member
How to get array values in ascending order.
Dear all ,
I have written the following program which is used to calculate the number of components and their names in an assembly file (solidworks, 3d modelling). But the array used in this program does not give values in ascending order. How to get a array values in ascending order.
For ex : a list box contains "n" No. of valuse, I need to extract all the values in ascending order, as it is listed in the list box.
How to get a array values in ascending order. ?
Regards
rajamaniThiruvengadam
Sub main()
Dim swApp As Object
Dim SWConfig As SldWorks.Configuration
Dim SWRootComp As SldWorks.component
Dim Children As Variant
Dim SWChild As SldWorks.component
Dim ChildCount As Integer
Dim bOldSetting As Boolean
Dim bRet As Boolean
Dim SWModel As SldWorks.ModelDoc2
Set swApp = Application.SldWorks
Set SWModel = swApp.ActiveDoc
Set SWConfig = SWModel.GetActiveConfiguration
Set SWRootComp = SWConfig.GetRootComponent
Children = SWRootComp.GetChildren
ChildCount = UBound(Children)
'Debug.Print SWRootComp.Name
Debug.Print ChildCount
For i = 0 To ChildCount
Set SWChild = Children(i)
'SwCmp1InsNam = swChild.Name2
'SwCmp1InsNam1 = swChild.Name2
Debug.Print i
Debug.Print SWChild.Name
Next i
End Sub
=======================
Actual order
Sub_Assy_1-1
Sub_Assy_2-3
Sub_Assy_3-4
Wrong_Planes_1-3
Wrong_Planes_2-3
=======================
Result I am getting is
0
Sub_Assy_2-3
1
Sub_Assy_3-4
2
Wrong_Planes_1-3
3
Sub_Assy_1-1
4
Wrong_Planes_2-3
-
Oct 13th, 2004, 02:48 AM
#2
just a suggestion
why don't u add values to a sorted listbox and get it back.
-
Oct 13th, 2004, 03:18 AM
#3
Thread Starter
Addicted Member
What is sorted list box ?
What is sorted list box ?
-
Oct 13th, 2004, 03:43 AM
#4
drop a ListBox Control on form and set its Sorted property to True.
-
Oct 13th, 2004, 04:21 AM
#5
Thread Starter
Addicted Member
Thank you deepak, Ithe problem is solved
-
Oct 13th, 2004, 04:24 AM
#6
u r welcome dude . put that green arrow in ur first post of this thread.
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
|