Guest JustAProg Posted September 18, 2002 Posted September 18, 2002 Like the various uses of 'myString.substring' are used in vb.net instead of the old vb6 left, right and mid. Can someone tell me the vb.net version of, for example: chr$(34) and asc("Z"), thanks. I don't want to use the above, or bring in the vb namespace, I'd like to find the proper vb.net way of doing them. Thanks Quote
*Gurus* Thinker Posted September 18, 2002 *Gurus* Posted September 18, 2002 Not sure if this is really any faster, but you can use the native System.Convert class. System.Windows.Forms.MessageBox.Show(System.Convert.ToChar(34)) 'Chr$(34) System.Windows.Forms.MessageBox.Show(System.Convert.ToByte("Z"c)) 'Asc("Z") Quote Posting Guidelines
Guest JustAProg Posted September 18, 2002 Posted September 18, 2002 Thank you. That's exactly what I was after, cheers. By the way, what's the 'little c' for, I thought it was a typo to start with then realised it's needed, seems rather out of place if ya know what I mean. >> ("Z"c) << Quote
*Experts* Bucky Posted September 18, 2002 *Experts* Posted September 18, 2002 The little c represents that the value in quote marks is a Char, not a String, so you can tell the difference when debugging. The ToChar method, as the name implies, returns a Char, not a String like Chr$() does. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Gurus* Thinker Posted September 18, 2002 *Gurus* Posted September 18, 2002 Good point Bucky. I should have pointed that out. You would have to do one more conversion to get the Char converted to a string. It has to be that way, because the ToString method would just change 34 to "34". Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.