I do not know C# well but the code obviously creates letter i in the alphabet.
This I am just able to manage without being a C# expert. ;)
My version was: (types used for less overhead)
Dim CodeA = Convert.ToUInt16("A"c)
Dim offset As UShort = 17
Dim NewCode = Convert.ToChar(CodeA + offset)
Or just replace CodeA by the literal 65US (unsigned short suffix) that we programmers
know by heart anyway. :) Oh, and add NewCode.ToString() if really required.
--
Armin
Or the other way of looking at it compared to Armin's answer: if the desired
result is "A1", "A2"... where i=1, 2... then
"A" & i.ToString()
--
Andrew
"Andrew Morton" wrote:
> .
>
But that is not what the C# code is doing. For i = 3, the C# code would
return "D", not "A3".
Mike
> But that is not what the C# code is doing. For i = 3, the C# code
> would return "D", not "A3".
At least I've learnt something new today :-)
Andrew
What about '... = ChrW(AscW("A"c) + i)'?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>