Fritz

MrPLC Member
  • Content count

    3
  • Joined

  • Last visited

Posts posted by Fritz


  1. On 4/23/2019 at 7:07 AM, simonongsk said:

                 There is a variable property for the Listbox, what do you specify?

     

    In properties page "variable" field can be left empty. It will show up as red box, but does not generate compile error. But basically this is your "selected index". Will work both ways.
    If you leave "variable" field empty, then selected index can be read out and set also programmatically:
     

    lstLogViewer.SelectedIndex = _selectedIndex
    
    _selectedIndex = lstLogViewer.SelectedIndex

     

    On 4/23/2019 at 7:07 AM, simonongsk said:

    What is the listbox Memeber for selected item
    ListBox0.SelectedItem.Value---> won't work

    You can not read out selected item itself or it's value, only index.
    To know the value, you need to keep track in you source array that was parameter in SetItems method.

    As I said earlier - Omron's visual components are extremely limited.


  2. 5 hours ago, simonongsk said:

    ...listbox and Dropbox or even Textbox should behave as such in Visual Studio?

    No, actually not.

    You can use VB.NET code in editor (Compact Framework 3.5) but visual components provided by Omron are not original .NET components. Those are Omron's own extremely limited versions. You can examine them with ILSpy from Omron libraries or use System.Reflection on runtime.


  3. I have used following code to update listbox contents:

    Dim logs As System.Collections.Generic.List(Of Object) = Nothing
    
    logs = New System.Collections.Generic.List(Of Object)
    logs.Add("one")
    logs.Add("two")
    logs.Add("three")
    
    lstLogViewer.SetItems(logs.ToArray())

    But also your code should work if you modify it as following:

     Sub ListBox_Update    
        Dim array(100) As Object
        Dim x As Integer
        For x = 0 To 99
            array(x) = ListItems(x)
        Next x
        listbox0.SetItems(array)
    End Sub 

    NB! Your "ListItems" must be array of strings !
    Basically: parameter passed to SetItems method must be array of objects, but those "objects" must be strings.