changing a column type of datagridview ?
-
hi all, i have a datagridview with 2 columns. one is StuID and the other is TermGrade. both are number fields. example: StuID TermGrade ----- --------- 2000 90 2001 80 2002 70 AVG: 80 i want to add a new row. which should contain the last row above. (AVG: under StuID field and 80 under TermGrade field) for TermGrade field everything is fine. cos it is a NUMBER field and i add a number in that cell. but for StuID field, i get type mismatch error since i try to add a STRING into NUMBER field. how can i get rid of this error ? is there a way to insert such a string (AVG:) to a number field ? help please, thanks in advance. bye. ps: how can i use footer in datagridview in windows forms with C# ? is possible to do what i want above with footer ?
-
hi all, i have a datagridview with 2 columns. one is StuID and the other is TermGrade. both are number fields. example: StuID TermGrade ----- --------- 2000 90 2001 80 2002 70 AVG: 80 i want to add a new row. which should contain the last row above. (AVG: under StuID field and 80 under TermGrade field) for TermGrade field everything is fine. cos it is a NUMBER field and i add a number in that cell. but for StuID field, i get type mismatch error since i try to add a STRING into NUMBER field. how can i get rid of this error ? is there a way to insert such a string (AVG:) to a number field ? help please, thanks in advance. bye. ps: how can i use footer in datagridview in windows forms with C# ? is possible to do what i want above with footer ?
Seems to me the easiest solution is to make the first column a STRING. All you are doing is using it for displaying data anyway. Verify that it is a valid value, convert it to a string for display in the datagrid. If you need to pull it out, all you have to do is cast it back to whatever numeric datatype you are using. HTH Gandalf