Changed from VB 2003 to 2005?

VonEhle

Active member
Joined
Feb 20, 2006
Messages
26
Programming Experience
Beginner
This line gives me an error on the ToChar in VB2005, saying ToChar is not declared:

Dim chrDelimiter() As Char = {ToChar(",")}


 
What are you trying to do? You can't write that in VB2003 either.
 
It did work in a program I wrote last year in VB2003. I have a text file with two fields per line. I'm trying to make it so the comma doesn't print out in the text box. So, the purpose in this declaration is to have it know that the comma is the delimiter.

In my VB2003 code I had

pstrFields = pstrLine.Split(chrDelimiter)

to break up the line.
 
You could have used the String.ToCharArray method, but since the String.Split methods parameter is a ParramArray you can do this and only submit this one char:
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] chrDelimiter [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Char[/COLOR][/SIZE][SIZE=2] = ","c
[/SIZE]
 
Back
Top