- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
The problem here is that i would like to fill in the property value a single string text of the selections the user makes
at the dropdown and presses ok button.
For example, if the user selects and clicks ok at PRIONI option and then at next pop up selects TORNOS and hit ok and then closes window,
the iproperty should look like this:
NyfanRooting PRIONI, TORNOS as a single string text value.
At this moment it only saves the last clicked selection but not the previous ones.
Do you know a way to fix and save all selections? Bellow is the code i am using now:
I feel i am close but i cant fix it yet..
Dim oTypes_Array As New ArrayList
oTypes_Array.Add("PRIONI")
oTypes_Array.Add("TRYPANI")
oTypes_Array.Add("TORNOS")
oTypes_Array.Add("MONTAZ")
oTypes_Array.Add("FREZA")
Dim oSelected As New ArrayList
While True
oTypes_Selected = InputListBox("CHOOSE:", oTypes_Array, oTypes_Array(0), oRuleNo, X_oProp_Array)
If IsNothing (oTypes_Selected) Then Exit While
oSelected.Add(oTypes_Selected)
End While
If oSelected.Count > 0 Then
For Each oText In oSelected
iProperties.Value("Custom", "NyfanRooting") = oText
next
End If
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try replacing this line:
If IsNothing (oTypes_Selected) Then Exit While
with this one:
If String.IsNullOrEmpty(oTypes_Selected) Then Exit While
or this one:
If oTypes_Selected = "" Then Exit While
Also, try replacing this line:
iProperties.Value("Custom", "NyfanRooting") = oText
with this one:
iProperties.Value("Custom", "NyfanRooting") = iProperties.Value("Custom", "NyfanRooting") & ", " & oText
If that last line doesn't work, try getting the existing value of that iProperty to a variable first, then use that variable in stead of the second iProperties.Value() call in that line of code. (I assume you want each selected text to follow the one before, with a comma between them, similar to what your image showed.)
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you very much! We almost did it, i think it only needs some fine tuning now!
I had to put a temp variable because it didn't work without, i had an error message.
Only problem is that if i choose 4 or more options, only 3 appear in the box of iproperty ( did test for character limit but it seems there isnt one, at least short one, check image)
result.
test for character limit:
And a minor problem is that it shows (comma) , before first word also which seems awkward.. ![]()
here is the code now.
Dim oTypes_Array As New ArrayList oTypes_Array.Add("PRIONI") oTypes_Array.Add("TRYPANI") oTypes_Array.Add("TORNOS") oTypes_Array.Add("MONTAZ") oTypes_Array.Add("FREZA") Dim oSelected As New ArrayList While True oTypes_Selected = InputListBox("CHOOSE:", oTypes_Array, oTypes_Array(0), oRuleNo, X_oProp_Array) If String.IsNullOrEmpty(oTypes_Selected) Then Exit While oSelected.Add(oTypes_Selected) End While If oSelected.Count > 0 Then For Each oText In oSelected iProperties.Value("Custom", "NyfanRooting") = tempx tempx = iProperties.Value("Custom", "NyfanRooting") & ", " & oText next End If
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Switch these two lines like so:
tempx = iProperties.Value("Custom", "NyfanRooting")
iProperties.Value("Custom", "NyfanRooting") = tempx & ", " & oText
The first line is setting the value of the variable 'tempx' from the iProperty.
The second line is including that value at the start of the new value of the iProperty we are giving it.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry for the delay, weekend-off.
I can't thank you enough for your help! ![]()
the only minor change i did is switching comma to the end, it feels better for me. I have to find a way to remove last comma, but is not something to rush for now.