Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

List box, select item

Status
Not open for further replies.

Zoes

Mechanical
Joined
Sep 30, 2011
Messages
46
Location
GB

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
 
list_box0Props.SetStrings("ListItems", list_box0Values)
Does this work? I did it like this:
list_box0Props.GetProperties.SetStrings("ListItems", list_box0Values)

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.


 
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. :)
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top