Welcome to AddressOf.com Sign in | Join | Help

Wow...

“Does anyone remember Asc() in VB 6.0? Is there a replacement in VB.Net?”

This is a quoted question posted in the GotDotNet.com forums.  Obviously we aren't getting the right message out if something as simple as this is tripping people up.  What can we do to improve?

Note: This is not the first time I've seen questions like this... this is just one example.

Published Monday, April 18, 2005 9:34 PM by CorySmith
Filed under:

Comments

# re: Wow...

Monday, April 18, 2005 10:13 PM by Alex
i think it's quite simple... put in snippets for most commonly used legacy functions. Just like one for "prop+TAB" expands to a whole property "Asc+TAB" would expand to whatever the alternative is.

Just my .02

# re: Wow...

Monday, April 18, 2005 11:37 PM by Cory Smith
I guess I should have been more clear... I thought the answer to the question was very obvious and didn't need to be given. I suppose I was wrong ;-)

The "replacement" to Asc() in VB.NET... wait for it... is Asc().

I guess my point with this entry is that people are so sure (and have been told as much, albeit inaccurately) that something is missing from VB, they immediately assume they have to find some other way to do the tasks that they already have familiarity. This just isn't true in many (if not most) cases. I'm not saying there's not a lot of changes, but that's not to say there's not a lot of things still the same. VB is made up of a lot of parts. You could significantly change 10% of language and those changes would look huge; however, that doesn't mean that the other 90% of the language has changed as well. (I'm using these numbers picked out of thin air, so digest accordingly.) Yes, some HUGE changes have been made that affect just about everyones development habits moving from VB6. However, there's still a lot (I would say more than not) that is still the same.

On another note. In VB8, there is a vbprop[tab] snippet that does this what you suggest for properties. I, however, don't like the implementation, so I created an alternative (which uses prop[tab]) that somewhat mimics the C# version. For what it's worth, I think there's something missing in the snippet implementation... and that's the ability to specify case formatting (PascalCase and camelCase) for the fill-in-the-blanks entries.

# re: Wow...

Sunday, January 29, 2006 7:44 PM by Drew
In defence of the 'learners' VB.Net is a flakey development engine. Sometimes it wants to run in debug mode, sometimes it 'hangs' (what else would you expect from MS?)
Try writing a project for Pocket PC. Despite all the best intentions by Microsoft, these sorts of functions as Asc() simply don't work on my PC anyway. I've tried adding and removing the VB.compatibility component etc. The code even compiles ok; but try running it on a Pocket PC device and it crashes, doesn't support the Asc() command or others similar. I figure MS should simply have not bothered with the Compatibility dll and just advise us the 'real' translation to VB.Net syntax instead of some half-baked sometimes-works solution..!

# re: Wow...

Wednesday, July 19, 2006 8:07 PM by Rusty
There is an equivelent to the ASC() but it's not pretty. If you want to throw away all legacy code, I would suggest you make your own Custom_ASC() method. The .NET equivelent I have found to work is:
Convert.ToByte(strVar.Chars(index)).ToString("X2")

# re: Wow...

Saturday, July 21, 2007 3:08 PM by Ms Confused
Why MS make such a simple Asc() function into: Convert.ToByte(strVar.Chars(index)).ToString("X2") Ugh.
Anonymous comments are disabled