TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Violeta Popa
NA
137
163.7k
variable is assigned but never used
Apr 9 2013 4:57 PM
Hi..what's wrong with this code? I declared the variable pret, and then used it, but i'm informed that is assigned but never used.
when form load{
double pret;// it's assigned but never used
if (cnp.StartsWith("1") || cnp.StartsWith("2"))
{
string an = "19" + cnp.Substring(1, 2);
string luna = cnp.Substring(3, 2);
string zi = cnp.Substring(5, 2);
string data_nastere = luna + "/" + zi + "/" + an;
DateTime data = Convert.ToDateTime(data_nastere);
TimeSpan zile = DateTime.Today.Subtract(data);
varsta = Convert.ToInt32(zile) / 356;
if (varsta <= 23)
{
if (double.Parse(tb2.Text) <= 1200)
pret = 340;
else if (double.Parse(tb2.Text) >= 1201 && double.Parse(tb2.Text) <= 1600)
pret = 486;
else if (double.Parse(tb2.Text) >= 1601 && double.Parse(tb2.Text) <= 2000)
pret = 535;
else if (double.Parse(tb2.Text) >= 2001 && double.Parse(tb2.Text) <= 2400)
pret = 583;
else if (double.Parse(tb2.Text) >= 2401 && double.Parse(tb2.Text) <= 3000)
pret = 729;
else if (double.Parse(tb2.Text) <= 3001)
pret = 1458;
}
}
Reply
Answers (
1
)
INSERT statement conflicted with the FOREIGN KEY contraint
How to validate Password textbox C# winfrom