VB6のLenB同等関数を作成
Shift_JIS でDB上のサイズに合わせて入力されるバイト数を制限したい場合、Lengthプロパティでは文字数が取得できてしまいバイト数が取得できません。
そこで、次のような関数を作成することでバイト数を取得できます。
Public Shared Function LenB(ByVal strValue As String) As Integer
Return System.Text.Encoding.GetEncoding("Shift_JIS").GetByteCount(strValue)
End Function