I receive this error when adding a row to a Table control:
"Input string was not in a correct format."
This occurs when I add a row that is a string, but not when I add a number. However, my table column is set as a string data type. I created the table control on a form, then dynamically add columns to it at runtime. Then, I populate the table with rows dynamically.
Here is my code to create the table:
tableMedsSummary.AddCol( cString, "id", 50 )
tableMedsSummary.AddCol( cString, "ptid", 50 )
tableMedsSummary.AddCol( cString, "NDC", 50 )
tableMedsSummary.AddCol( cString, "Drug Name", 50 )
tableMedsSummary.AddCol( cString, "Change", 50 )
tableMedsSummary.AddCol( cString, "Dose", 50 )
tableMedsSummary.AddCol( cString, "Route", 50 )
tableMedsSummary.AddCol( cString, "Frequency", 50 )
tableMedsSummary.AddCol( cString, "Start Date", 50 )
tableMedsSummary.AddCol( cString, "D/C Date", 50 )
tableMedsSummary.AddCol( cString, "dxHOLD", 50 )
tableMedsSummary.AddCol( cString, "Comment", 50 )
Here is the code to add a row to the table:
tableMedsSummary.AddRow( id, ptid, ndc, drugname, change, dose, route, freq, startdate, dcdate, dx, comment )
The problem is with the dxHOLD column. If the "dx" variable is a number or null, I receive no error. But, if it is a string, I receive the error. You can see that I create the dxHOLD column as a string data type.
What gives? Any help would be appreciated.
"Input string was not in a correct format."
This occurs when I add a row that is a string, but not when I add a number. However, my table column is set as a string data type. I created the table control on a form, then dynamically add columns to it at runtime. Then, I populate the table with rows dynamically.
Here is my code to create the table:
tableMedsSummary.AddCol( cString, "id", 50 )
tableMedsSummary.AddCol( cString, "ptid", 50 )
tableMedsSummary.AddCol( cString, "NDC", 50 )
tableMedsSummary.AddCol( cString, "Drug Name", 50 )
tableMedsSummary.AddCol( cString, "Change", 50 )
tableMedsSummary.AddCol( cString, "Dose", 50 )
tableMedsSummary.AddCol( cString, "Route", 50 )
tableMedsSummary.AddCol( cString, "Frequency", 50 )
tableMedsSummary.AddCol( cString, "Start Date", 50 )
tableMedsSummary.AddCol( cString, "D/C Date", 50 )
tableMedsSummary.AddCol( cString, "dxHOLD", 50 )
tableMedsSummary.AddCol( cString, "Comment", 50 )
Here is the code to add a row to the table:
tableMedsSummary.AddRow( id, ptid, ndc, drugname, change, dose, route, freq, startdate, dcdate, dx, comment )
The problem is with the dxHOLD column. If the "dx" variable is a number or null, I receive no error. But, if it is a string, I receive the error. You can see that I create the dxHOLD column as a string data type.
What gives? Any help would be appreciated.