Question SetDelimiters as variable

gchq

Well-known member
Joined
Dec 14, 2007
Messages
168
Programming Experience
10+
Hi there

I am attempting to set the delimeters for reading a csv file to a variable (in case it is not seperated by a comma) so that in

VB.NET:
Reader.SetDelimiters(","c)

"," can be set as a variable - I have tried a number of ways but the character literal is the problem.

Thanks
 
Dim vChar as Char = textbox.text
Reader.SetDelimiters(vChar)

with a number of csv files and it seems to be working fine. The character literal threw me out...
SetDelimiters method doesn't have an overload that takes a Char type parameter (it doesn't have any overloads at all in fact). You can only pass one or more String values. If you do pass a Char value it will implicitly be converted to a String value by compiler, this is a CType widening conversion.
 
SetDelimiters method doesn't have an overload that takes a Char type parameter. You can only pass one or more String values. If you do pass a Char value it will implicitly be converted to a String value by compiler, this is a CType widening conversion.

This was set to string originally - it was just the character literal (c) that was causing me to run round in circles.

Thanks again to both of you for your patience
 
Back
Top