BrettNelson
Member
- Joined
- Apr 8, 2016
- Messages
- 11
- Programming Experience
- Beginner
Visual Studio 2012
VB.NET
Framework 3.5
I have also unchecked the Microsoft.VisualBasic from the Imported Namespaces
I have two examples below.
Does anyone know if the line that uses the ASCII.GetBytes is an acceptable / reliable way to get an ASCII decimal value from a single alphabet character? Is there an easier, shorter or cleaner way to get the ASCII value of a single alphabet character?
VB.NET
Framework 3.5
I have also unchecked the Microsoft.VisualBasic from the Imported Namespaces
I have two examples below.
Does anyone know if the line that uses the ASCII.GetBytes is an acceptable / reliable way to get an ASCII decimal value from a single alphabet character? Is there an easier, shorter or cleaner way to get the ASCII value of a single alphabet character?
VB.NET:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim testChar As String = "a"
Debug.WriteLine(System.Text.Encoding.ASCII.GetBytes(testChar)(0)) ' this seems to work perfectly, referencing the sole element, 0
Debug.WriteLine(Convert.ToInt32("a"c)) ' this one seems cleaner but I can't use the (testChar) variable with it
End Sub