Hi i work in windows form application viusal studio 2008
I have windows form have two labeles label 33, label 34
label 33 represent quantity required
label 34 represent quantity shipped
if (Convert.ToInt32(label33.Text) == 0 && Convert.ToInt32(label34.Text) == 0)
{
Sales.
SalesClass SalesClass3 = new Sales.SalesClass();SalesClass3.DeleteProcessThird(
"Data Source=192.168.1.3;Initial Catalog=ALTAWI Group-Live;User ID=admin;Password=3210;Connection Lifetime=3;Max Pool Size=3;Connection Timeout=30");}
problem when converting string to integer
it give me error excption
Input sring was not in correct formate
how to solve this problem

Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 19, 2015, 2:26 PM EDT
int myValue =0;
if(int.TryParse(Label1.Text,out myValue))
{
//the rest of your code here
}
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted May 19, 2015, 8:48 PM EDT
But among of all I think the
TryParseis best.ahmed saRank #8,218 · 226 reputationPosted May 19, 2015, 9:05 PM EDT
ahmed saRank #8,218 · 226 reputationPosted May 19, 2015, 9:11 PM EDT
Michal HabalcikRank #902 · 2.3K reputationPosted May 19, 2015, 9:36 PM EDT
ahmed saRank #8,218 · 226 reputationPosted May 19, 2015, 9:46 PM EDT
Michal HabalcikRank #902 · 2.3K reputationPosted May 19, 2015, 9:50 PM EDT
if (int.TryParse(label33.Text, out lbl 33) && int.TryParse(label34.Text, out lbl 34))
{
Sales.SalesClass SalesClass3 = new Sales.SalesClass();
SalesClass3.DeleteProcessThird("Data Source=192.168.1.3;Initial Catalog=ALTAWI Group-Live;User ID=admin;Password=3210;Connection Lifetime=3;Max Pool Size=3;Connection Timeout=30");
}