Yeison Iguaran
Yeison Iguaran

Reputation: 1

VB.Net VS2019 - Problem reading in console

I request your help to be able to read these symbols in the windows console.

Imports System.Text

Module Module1

    Sub Main()
        Dim userInput = New StringBuilder()
        Dim maxLength = 10
        While True
            ' Read, but don't output character
            Dim cki As ConsoleKeyInfo = Console.ReadKey(True)
            Select Case cki.Key
                Case ConsoleKey.Enter
                    ' Done
                    Exit While
                Case ConsoleKey.Backspace
                    ' Last char deleted
                    If userInput.Length > 0 Then
                        userInput.Remove(userInput.Length - 1, 1)
                        Console.Write(vbBack & " " & vbBack)
                    End If
                Case Else
                    ' Only append if less than max entered and it's a display character
                    If userInput.Length < maxLength AndAlso Not Char.IsControl(cki.KeyChar) Then
                        userInput.Append(cki.KeyChar)
                        Console.Write(cki.KeyChar)
                    End If
            End Select
        End While
        MsgBox("'" & userInput.ToString() & "'")
    End Sub

End Module

I just installed Visual Studio 2019 and pasted the code to test the new program, to my surprise, I ran into the problem of not being able to read the Ñ and Ó. I don't know what's going on, how to fix it and prevent it from happening again.

That is very strange, I know that the code should work (it worked on my previous PC), but this does not work now; only question marks come out when i try.

Change from Win7 and VS 2015 to Win10 and VS 2019, what could be missing from my new PC?

I appreciate the help in advance.

Upvotes: 0

Views: 99

Answers (0)

Related Questions