int n = 0;
ushort[] data = new ushort[8];
ushort[] dataCompare = new ushort[8];
ushort[] sendData = new ushort[8];
ushort id,scalefactor, currentValue;
int numValue = Convert.ToInt32 (currentCell.Ro wIndex.ToString ());
string[] cellType = currentCell.ToS tring().Split(n ew char[] { ' ' });
switch (cellType[0])
{
case "DataGridViewTe xtBoxCell":
if (numValue < _responseparser .tableId.Count)
{
id = ushort.Parse(_r esponseparser.t ableId[numValue].ToString());
string editValue = currentCell.Edi tedFormattedVal ue.ToString();
//Getting error in this line "Input string was not in correct format"
int s = Convert.ToInt32 (editValue); scalefactor = ushort.Parse(_r esponseparser.t ableScaleFactor[numValue].ToString());
decimal saveValue = ((decimal)s / (decimal)scalef actor);
data[0] =saveValue;
CommMngr.Select edUnit.Modbus.S etParameter(id, data);
dataCompare = CommMngr.Select edUnit.Modbus.G etParameter(id) ;
if (data[0] != dataCompare[0])
{
MessageBox.Show ("Value Edit Failed, ModBus Return Value = " + dataCompare[0]);
}
}
break;
bolded line gives me a exception "Input string was not in correct format"
ushort[] data = new ushort[8];
ushort[] dataCompare = new ushort[8];
ushort[] sendData = new ushort[8];
ushort id,scalefactor, currentValue;
int numValue = Convert.ToInt32 (currentCell.Ro wIndex.ToString ());
string[] cellType = currentCell.ToS tring().Split(n ew char[] { ' ' });
switch (cellType[0])
{
case "DataGridViewTe xtBoxCell":
if (numValue < _responseparser .tableId.Count)
{
id = ushort.Parse(_r esponseparser.t ableId[numValue].ToString());
string editValue = currentCell.Edi tedFormattedVal ue.ToString();
//Getting error in this line "Input string was not in correct format"
int s = Convert.ToInt32 (editValue); scalefactor = ushort.Parse(_r esponseparser.t ableScaleFactor[numValue].ToString());
decimal saveValue = ((decimal)s / (decimal)scalef actor);
data[0] =saveValue;
CommMngr.Select edUnit.Modbus.S etParameter(id, data);
dataCompare = CommMngr.Select edUnit.Modbus.G etParameter(id) ;
if (data[0] != dataCompare[0])
{
MessageBox.Show ("Value Edit Failed, ModBus Return Value = " + dataCompare[0]);
}
}
break;
bolded line gives me a exception "Input string was not in correct format"