OVH Cloud OVH Cloud

AscB("A") de VB6 vers VB .net

2 réponses
Avatar
cr
Bonjour
je passe un pgme de VB6 à VB .net et cette fonction de conversion ascii
n'est plus suportée (on peut se demander pourquoi ?).

j'ai essayé l'aide du wizard mais ca n'aboutit pas.

qqu'un aurait_il ca sous la main ?

merci

2 réponses

Avatar
Fred
Dans son message 427908ec$0$171$
cr nous dit :

Bonjour
je passe un pgme de VB6 à VB .net et cette fonction de conversion
ascii n'est plus suportée (on peut se demander pourquoi ?).

j'ai essayé l'aide du wizard mais ca n'aboutit pas.

qqu'un aurait_il ca sous la main ?

merci



Bonsoir,

Il n'y a plus de AscB, mais il y a toujours Asc et AscW.
En quoi le AscB t'est-il indispensable ?
En .NET, toutes les chaînes sont codées en Unicode (2 octets par caractère).

Extrait MSDN US (la version française est mal traduite) :
8<----
Asc returns the code point, or character code, for the input character. This
can be 0 through 255 for single-byte character set (SBCS) values and -32768
through 32767 for double-byte character set (DBCS) values. The returned
value depends on the code page for the current thread, which is contained in
the ANSICodePage property of the TextInfo class. TextInfo.ANSICodePage can
be obtained by specifying
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.

AscW returns the Unicode code point for the input character. This can be 0
through 65535. The returned value is independent of the culture and code
page settings for the current thread.

Note The AscB function of earlier versions of Visual Basic returns a code
for a byte, rather than a character. It is used primarily for converting
strings in double-byte character set (DBCS) applications. All Visual Basic
.NET strings are in Unicode, and AscB is no longer supported.
8<----

Cela répond-il à ta question ?
Il y aurait encore beaucoup à dire sur les encodages : regarde du côté de la
classe System.Text.Encoding


--
Fred
Avatar
cr
merci bien Fred
bonne soirée