delete tab characters from listbox entries

I need to search and destroy tab characters that have been imported into the listbox. They tend to muck things up on export. I tried this (and a couple other things) with no luck…

[code] rg.searchPattern = “[\t]”

myMatch = rg.search(editorWin.listBox1.cell(i,2))

for i = 0 to editorWin.listBox1.listCount-1

if myMatch <> nil then
editorWin.listBox1.cell(i,2) = editorWin.listBox1.cell(i,2).replaceAll(rg.searchPattern,"")
end if

next
[/code]

 for i = 0 to editorWin.listBox1.listCount-1
      editorWin.listBox1.cell(i,2) = ReplaceAll(editorWin.listBox1.cell(i,2),ChrB(9),"")
  next

thanks Dave!

listBox1.cell(-1,-1) = listBox1.cell(-1,-1).ReplaceAll(chr(9),"")

well I’ll be d**mned… I didn’t think that would work, but I guess behinds the scenes it loops thru things one at a time

And Patrick… you should not delete your original post. for a few reasons

  1. so anyone that looks at these solutions, knows what the original problem was
  2. so they can see that you did indeed attempt to solve it yourself before asking for help

But doesn’t that dump everything into the first column? listbox.Cell(-1,-1) returns a tab-delimited file. You’re killing all the tabs, not just the ones in the actual data.

It actually does seem to work… I wrote a little test, and was amazed

I too wrote a little test, and was not at all surprised to find it fails. I’d like to see a multicolumn listbox this works on.