Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

vb6 filter function keeps throwing "type mismatch" error

$
0
0
Can someone tell me why the following isn't working? I'm trying to strip all the commas out of a string using the filter function and it keeps throwing a type mismatch error. Here's the code:

dim sFirstString as string
dim sResultString() as string
dim sComma as string

sComma = ","

sFirstString = "John Doe, 1111 1st Street, No Town, TX, 77777"

sResultString = filter(sFirstString, sComma, False)

Yes, I know I could do this with split and join, but I wanted to try the filter function. If I understand the I should be getting sResultString = "John Doe 1111 1st Street No Town 77777" , but instead I keep getting the "type mismatch" error.

Can any one tell me what I'm doing wrong?

Thanks in advance.

Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>