[SOLVED] ListBox passed

Hi group, I have another problem. I have a series of TabPanels and for each one a listbox with a unique, non-indexed name. I’m building a Method, and I was wondering … is there a chance to pass the object as data? Something like Dim MyList as listbox?

You can certainly pass ListBox and other controls to methods. Also, yes you can declare a variable to hold a reference to a control and access its contents and properties. Take the following method:

Function TotalValue( myListBox as DesktopListBox ) as Double
   Var dTotalValue as Double
   For i as Integer = 0 to myListBox.LastRowIndex
      dTotalValue = dTotalValue + myListBox.CellTextAt( i, 0 ).ToDouble
   Next
   Return dTotalValue
End Function

You can call it as:

messageBox( str( TotalValue( AnyListBox ) ) )

Ok perfect …thanks.

Don’t add Solved to the subject. Tick the box on the post that shows the solution. That makes it with the green tick and indicates how to solve it too.

Sorry, I don’t understand how to do it.

One way to do this, is to create a Module - everything in a module is globally available - then add a property to the module and save a reference to the ListBox.

@Ian_Kennedy beat me with saving a reference !

Yes thanks, I did this … all in a global module.

That’s odd the tick seems to have gone missing. When ticked it should show the word solution. It is only available to the original poster. In the row at the bottom of each post there should be a solution button.

The tick only shows to the author of the topic.

Federico should see something like this below the response that is the solution:
image

If Federico click the Solution tick then the title will change to show a green checkmark.

Edit: and will also turn to this on the selected post as solution:
image
image

This looks like what you asked:
DesktopListBox Contents

similar (but different name) exists in API1: ListBox.List

on my search screen, I have a one tab panel with multiple tab and just one listbox below… and depends on which tab you are on, you can use the same listbox but show different information.

you can passed over the listbox to a method and also passed the listbox back from the method.