Hi everyone. I want to display a table of unicode in my data grid view table with 32 column to view from \u0000 to \u001f for first row and continue on the second.
I make a loop to automate this function but it just doesn't seem to work correctly.
int numCols = 30;
int startChar = 0x00;
int endChar = 0xFF;
List<string> row = new List<string>();
for (int ch = startChar; ch <= endChar; ++ch)
{
row.Add(string.Format("\\u000{0:x}", ch));
if (row.Count == numCols)
{
addToDataGrid(row.ToArray());
row.Clear();
}
}
addToDataGrid(row.ToArray());
}
private void addToDataGrid(string[] strings)
{
foreach (string str in strings)
{
datagrd.Rows.Add(strings);
}
}
Witht he code above, i encountered:
1. The unicode is not displayed but the number itself is. (example: \u000f)
2. i have 32 columns. the displayed result is that each \u0000 will repeat for 30 rows too before going to \u0010 and repeat for 30 rows again.
I tried to edit but can't really get it to work. Please help.
And is there anyway to make the 4 unit hex editable instead of just the last 2?
Thanks everyone. Need it for my school project.
Answers
Know the answer? Post it. Somebody with the same question will find it here.