How to replace CellCheckBoxStateAt(row,col) by RowTagAt()

Hi,
How to use a RowTagAt(“string”) rather than the row index which can change?
for example

if Listbox1.CellCheckBoxStateAt(1,0) = DesktopCheckbox.VisualStates.Checked then
  //Do anything
end

It really depends on what you’re trying to do. But if you’ve got various rows that could be in any order, you’d need to loop through and check them either way.

for i as integer = 0 to listbox1.lastindex

if Listbox1.CellCheckBoxStateAt(i,0) = DesktopCheckbox.VisualStates.Checked then
  //Do anything
end if

if listbox1.rowtagat(i) = "whatever" then
//do whatever
end if

next

RowTag is a variant and can take just about any type of value. If you are just looking for True / False setting you could store a boolean in there with True / False. Then you can write code like:

for i as integer = 0 to listbox1.lastindex
   if listbox1.RowTagAt(i) then
      //do whatever
   end if
next

For this to work you must have stored a True or False into the RowTag on every row in the ListBox.

If you need the full tristate values that DesktopCheckbox.VisualStates supports then you would have to store an integer into the RowState and query against that. To still use the constant you would have to do:

ListBox.RowTagAt( anyRow ) = Integer( DesktopCheckbox.VisualStates.Checked )

if ListBox.RowTagAt( anyRow ) = Integer( DesktopCheckbox.VisualStates.Checked ) then
   // Do anything
end if