Copying WebListBox Contents To Another WebListBox

Hello, I’m trying to get the contents of one WebListBox from one webpage to copy to a WebListBox of another page. I’m struggling with this, each WebListBox has 4 columns. I have an ‘Open’ Event Handler in the new WebListBox so when it’s opened from button press it can populate itself with the data from the other WebListBox. Does anyone know the best approach for this?

The WebListBox is called: lbMDS

Many Thanks

The best would probably to use an underlying array or class to hold the data and use the weblistbox only for UI purposes. Alternately, use a webcontainer that contains the weblistbox and any other necessary control. You would programmatically (or at design time) place the container control where it needs to go on the page. You would re-load the data every time you need to show the weblistbox (I am assuming that it does not contain static data. If it does, no need to re-load the data every time.)

You can pass the listbox from page1 as parameter to the constructor of page2

Page1 - button code
Dim w As new WebPage2(listbox1)
w.show

in page2 you do whatever you need with it

page2 - constructor(lb As WebListBox)

‘ here I just replicate the listbox
for i As integer = 0 to lb.lastindex
   listbox1.addrow(lb.cell(i,0))
next

If you’re not using WebPages but rather ContainerControl I would not use the constructor as I had many issues, but you can also store your listbox in a public property in page2 or call a page2.function to pass parameters.