0

Using the commandline visual basic compiler (vbc.exe) with option VBruntime- does not allow using chr() or chrw() to specify a literal char. MSDN gives "x"c as solution to specify a literal character. That works fine, but how can i specify a literal character for a integer value.

BenMorel
  • 34,448
  • 50
  • 182
  • 322

1 Answers1

1

You should be able to use System.Convert.ToChar() to convert an integer to a character value. That is defined in mscorlib so it will be available no matter what your command line options.

shf301
  • 31,086
  • 2
  • 52
  • 86
  • perfect answer, thank you. Now i want to have a one char string from a constant integer. I can do it as follows : Dim Lc as Char = Convert.ToChar(&H09):Dim Lca(0) as Char:Lca(0)=Lc:Dim Ls$=New string(Lca) . Do you know a shorter syntax? –  Jun 17 '12 at 16:31
  • Use the String construtor that takes a `Char` and a count: `Dim Ls$=New string(Convert.ToChar(&H09), 1)` - Please my answer as accepted by checking the checkmark. – shf301 Jun 17 '12 at 18:32