Joe Devine

Access to List Box in Process Book Via Add In

Discussion created by Joe Devine on Sep 12, 2012
Latest reply on Sep 12, 2012 by Joe Devine

I am trying to populate a list box on a Process Book display from AF tables and or AF Attributes but I am having issues binding to the List Box object in order to add items to the list.  I can find the symbol object that is a List Box on the display and then I want to declare that symbol as a List box so that I can then start inserting values into the list.  Any help in doing this declaration would be appreciated.  This again is a Process Book Add In Form that is initialized from a command button on the button bar.


Here is the code I am using to run this test to just get capability.  The error that is thrown is related to the conversion of the Symbol to a Listbox.

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim iCount As Integer
        Dim A As Integer
        Dim iName As String
        Dim TheList As New ListBox

        ThisDisplay = App.ActiveDisplay

        iCount = ThisDisplay.Symbols.Count
        For A = 1 To iCount
            iName = ThisDisplay.Symbols.Item(A).Name
            If iName = "ListBox1" Then
                TheList = ThisDisplay.Symbols.Item(iName)

                Dim EntryCount As Single
                For EntryCount = 1 To 10
                    EntryCount = EntryCount + 1
                    TheList.Items.Add(EntryCount & " - Selection")
                Next EntryCount
            End If

    End Sub