3
Answers

Char to String

Grant McConville

Grant McConville

15y
8.8k
1
Can anyone please help me with what should be a simple line of code I would like to create some columns in a datatable called 'Column A' etc, and I am using this code to try to do create the name. string ColumnName; for (int counter = 1; counter <= 26; counter++) ColumnName = "Column " + Convert.ToString((char) counter + 64); What happens is the ColumnName holds 'Column 65'. It does not seem to be seeing (char). If I change the code to the following then it works fine, but thats not how I want to do it. Any ideas on what I am doing wrong please? string ColumnName; for (int counter = 65; counter <= 90; counter++) ColumnName = "Column " + Convert.ToString((char) counter);

Answers (3)