×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

List box, select item

List box, select item

List box, select item

(OP)

I have been very confused with identifying a selected item from a list box generated from blockstyler.. I have sort of idea (see follwong code) Does anybody know how to do this? Isn't it simple to code?

Dim lw As ListingWindow = theSession.ListingWindow
Dim list_box0Props As PropertyList = list_box0.GetProperties()
Dim list_box0Values() As String = {"Item 1", "Item 2", "Item 3"}
list_box0Props.SetStrings("ListItems", list_box0Values)
Dim selected As String() = list_box0Props.SelectedItems
If selected(0) Then
lw = theSession.ListingWindow
lw.Open()
lw.WriteLine("Item 1")
End If

RE: List box, select item

Quote:

list_box0Props.SetStrings("ListItems", list_box0Values)
Does this work? I did it like this:
list_box0Props.GetProperties.SetStrings("ListItems", list_box0Values)

Quote:

Dim selected As String() = list_box0Props.SelectedItems
Yes, I remember struggling with this part and going nowhere. What I eventually did was this:
Dim myVector() As Integer
myVector = list_box0.GetProperties.GetIntegerVector("SelectedItems")

I hope this helps.

I don't know how to get your item from the list by this vector because I never did that - for my own reasons I simultaneously populated the list and some array of my own, and read my items by that vector from the array.


 

RE: List box, select item

Quote:

Does this work? I did it like this:
list_box0Props.GetProperties.SetStrings("ListItems", list_box0Values)
Scratch this one. I didn't pay enough attention to your code. I'm not a professional programmer, after all. :)

RE: List box, select item

it comes up a question,

in this line of code:

myVector = list_box0.GetProperties.GetIntegerVector("SelectedItems")

Where can I find in the API the property name, in this case "SelectedItems"?

Thank you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources