「VB.NET」文字列を全角から半角へ変換するサンプル
構文
StrConv(変換文字列, VbStrConv.Narrow)
Public Enum VbStrConv
フィールド Narrow 文字列内の横幅の広い (全角) 文字を、横幅の狭い (半角) 文字に変換します。 アジアのロケールに適用されます。
使用例
Module Module1
    Sub Main()
        Dim strZen As String = "テスト123"
        Console.WriteLine("全角文字: " + strZen)
        Console.WriteLine(Len(strZen))
        'FunctiontestFuncを呼び出す
        testFunc(strZen)
        Console.ReadKey()
    End Sub
    '文字列を全角から半角へ変換
    Public Function testFunc(ByVal target As String) As String
        Dim res As String
        '全角を半角へ変換
        res = StrConv(target, VbStrConv.Narrow)
        Console.WriteLine("半角文字:" + res)
        Console.WriteLine(Len(res))
        Return res
    End Function
End Module
結果
全角文字: テスト123
6
半角文字:テスト123
6