I'm writing a tiny hex viewer for my own needs. Stuck in a situation where the standard Label control won't show up an unprintable characters in string:
public string ToASCIIstring(int numColumns)
{
string ret = String.Empty;
int stringBegin = 0;
for (int i = 0; i < Data.Length; i++)
{
int colNum = i % numColumns;
if ((colNum + 1 == numColumns) || (i == Data.Length -1 ))
{
ret += Encoding.ASCII.GetString(Data, stringBegin, colNum);
stringBegin = i + 1;
ret += "\n";
}
}
return ret;
}
This method returns the correct ASCII string, but after assigning it to the Label.Text property it becomes just an Empty string and nothing is displayed.
Any help on that would be lovely
P.S. I know the code is awful, but it's never gonna see the production, it's just my own analysis tool