Thank you for the advice - I found my old project with the code there.
Dim a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 As String
a1=ListBox1.Cell(0,0)
a2=ListBox1.cell(1,0)
a3=ListBox1.cell(2,0)
a4=ListBox1.cell(3,0)
a5=ListBox1.cell(4,0)
a6=ListBox1.cell(5,0)
a7=ListBox1.cell(6,0)
a8=ListBox1.cell(7,0)
a9=ListBox1.cell(8,0)
a10=ListBox1.cell(9,0)
if ListBox1.text=a1 then
PagePanel1.Value=1
elseif ListBox1.text=a2 then
PagePanel1.Value=2
elseif ListBox1.text=a3 then
PagePanel1.Value=3
elseif ListBox1.text=a4 then
PagePanel1.Value=4
elseif ListBox1.text=a5 then
PagePanel1.Value=5
elseif ListBox1.text=a6 then
PagePanel1.Value=6
elseif ListBox1.text=a7 then
PagePanel1.Value=7
elseif ListBox1.text=a8 then
PagePanel1.Value=8
elseif ListBox1.text=a9 then
PagePanel1.Value=9
elseif ListBox1.text=a10 then
PagePanel1.Value=10
end if
One thing is left to figure out - how to count the number of rows in the ListBox (it will be dynamically populated) and create a corresponding number string variables with the corresponding number of “If … then” statements.
I am pretty sure it must be done through the arrays and looping but I have to figure out the code.
Tim, on the second thought, that code will not work for me.
In my case the PagePanel will have a large number of the pages.
The CheckList will be dynamically populated. When the row is changed, the value of the row should be obtained, and then the PagePanel should be set to the corresponding page.
It is a little more complicated. If I had a static CheckList, your code would work perfectly.
Again, thank you for your help. I will remember your little piece of wisdom for my future references.