当前位置: 动力学知识库 > 问答 > 编程问答 >

string - Syntax error when converting Byte to Char in VB.NET

问题描述:

An error pops up when I write this:

ListView1.Items(0).SubItems.Add(Convert.ToChar(byteData(i)))

The error is:

Overload resolution failed because no accessible 'Convert' accepts this number of arguments.

网友答案:

the Convert.ToChar will work for converting a byte to a char. for example the following cod will work without any problem:

    Dim byteArray(10) As Byte
    byteArray(0) = 65 'code of 'A' char
    Dim ch As Char
    ch = Convert.ToChar(byteArray(0)) 'ch becomes 'A'c

Can you explai more about what type is byteData(i) in your code? maybe it is not a byte as you expected. please check it or give more info from where you have defined it?

分享给朋友:
您可能感兴趣的文章:
随机阅读: