Error in Converting Column Value from 'Number' to Character

Hello all,

Iam trying to get the last column value and i have the column number but i want it in Column name like A , B , C. So for that i am converting that number to character using the below code.it was working very fine but today i observed that while converting instaed of giving the character “Y” its giving “]” and got is failing to read the range.Kindly help me out

Convert.ToChar(convert.ToUInt16(C)+24)

Have a look here:
grafik

Also have a look here:

Deja vue or something different is needed?

@Aswini

dt.columns.count

Gives you the column count

If you want last column name use

Dt.columns(dt.columns.count-1)

Or you want last value of the lastcolumn

lastrow=Dt.asenumnerable.last

lastrow(dt.columns.count-1)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.