16
Answers

Input string was not in a correct format.

Photo of john kanyora

john kanyora

7y
292
1
Hi, am converting string to decimal because i want my values to be represented in decimal form in my bar chart.am getting the error that " Input string was not in a correct format"..
 
the error is in this line y[i]=Convert.ToDecimal(string.Format("{0}.00",dt.Rows[i][1].ToString()));
am usin this code below
 
string[] x = new string[dt.Rows.Count];
decimal[] y = new decimal[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
{
x[i] = dt.Rows[i][0].ToString();
y[i]=Convert.ToDecimal(string.Format("{0}.00",dt.Rows[i][1].ToString()));
}
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries {Data=y });
BarChart1.CategoriesAxis = string.Join(",", x);
BarChart1.ChartWidth = 500.ToString();
BarChart1.ChartHeight = 600.ToString();
}
 
kindly help

Answers (16)

0
Photo of dominic scanlan
NA 2 0 15y

Process
p = Process.GetCurrentProcess();
int i = p.Id;
0
Photo of Lalit M
NA 6.7k 48k 15y
use this code sample to get PID

using System.Diagnostics;
private void GetProcessStatus()
{
try
{
//If you know the name of the process
Process[] myProcesses = Process.GetProcessesByName("mspaint");
//If you know the PID of the process use the commented line below
//Process[] myProcesses = Process.GetProcessById("2341");
//Check to see if the process array length is greater than 0
if(myProcesses.Length > 0)
{
MessageBox.Show("The Process Microsoft Paint(mspaint) is currently running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("The Process Microsoft Paint(mspaint) is currently NOT running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch(Exception ex)
{
MessageBox.Show("An Exception Occoured: " + ex.Message, "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}


check also