FeatureClassProperty Split string

FeatureClassProperty Split string

Sgear
Advocate Advocate
824 Views
5 Replies
Message 1 of 6

FeatureClassProperty Split string

Sgear
Advocate
Advocate

 

Hi 

 

I am try with this sample to split the string but nothing happened still get it in one line not the string I need
someone who can tell me what is wrong with this Please

 

 

                    Dim cls_manager As Autodesk.Gis.Map.Classification.ClassificationManager = Nothing
                        cls_manager = Autodesk.Gis.Map.HostMapApplicationServices.Application.ActiveProject.ClassificationManager

                        Dim objClass_Property As FeatureClassPropertyCollection = New FeatureClassPropertyCollection()
                        Dim list_values As System.Collections.ArrayList = Nothing

                        cls_manager.GetProperties(objClass_Property,list_values, objId)
                        Dim Class_Property As FeatureClassProperty = Nothing

                        For Each Class_Property In objClass_Property


                            Dim propName As System.String = Class_Property.Name
                            Dim propValue As String = Class_Property.DefaultValue.ToString

                            Dim str As String = propValue
                            Dim strArr() As String
                            Dim count As Integer = 0
                            Dim strArrLength As Integer = 0
                            strArr = str.Split(" ")
                            strArrLength = strArr.Length

                            For count = 0 To strArrLength - 1

                                Utility.ShowMsg(vbNewLine & strArr(0))

                            Next

                        Next
0 Likes
825 Views
5 Replies
Replies (5)
Message 2 of 6

fieldguy
Advisor
Advisor

Split uses Char.  Not sure about the VB syntax.

 

Something like 

strArr = str.Split(new char() {" "c})

 

0 Likes
Message 3 of 6

Norman_Yuan
Mentor
Mentor

Besides what was pointed out by fieldguy, the line of code in the For...Next loop for showing the splitting result does not show the result correctly. 

 

instead of 

 

Utility.ShowMsg(vbNewLine & strArr(0))

 

It should be

 

Utility.ShowMsg(vbNewLine & strArr(count))

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 4 of 6

Sgear
Advocate
Advocate

If I use 

Utility.ShowMsg(vbNewLine & strArr(count))

 

I get the list but I am try to get the last line = 5.76828047914221

 

so I was try to split the sting = Utility.ShowMsg(vbNewLine & strArr(14))

 

I can use strArr(0)) but not 1 or higher the string don't split

 

 

 

System.__ComObject
-lí10-Line
ByLayer
1
ByLayer
-1
ByLayer
System.__ComObject
0
0
0
0
False
True
5.76828047914221
0 Likes
Message 5 of 6

fieldguy
Advisor
Advisor

The string won't split because there is no string.  You are showing a list of strings (dxfvalues??) and none of them has a space in them.

 

You better research what you are looking for (Map API?).  "FeatureClassPropertyCollection" is what you need I think - I've never used it 

 

 

0 Likes
Message 6 of 6

hgasty1001
Advisor
Advisor

Hi,

 

What about  just calling: strArr=split(str," ") ?

 

Gaston Nunez

0 Likes