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
Sathya Narayan
NA
155
65k
Formula Calculation
Mar 20 2014 2:12 AM
hi,
I am trying to calculate the internal marks of an student.Taking 4 textboxes in that 3 textboxes for internals marks and 4th textbox for calculating the average marks of the student
i am getting an error message while calculating the values using this formula.
This is my code
public void TotalMarks(double m1, double m2, double m3)
{
double fm;
double sm;
double avg;
if((m1>=m2 )&(m1>=m3))
{
fm = m1;
if (m2 >= m3)
{
sm = m2;
}
else
{
sm = m3;
}
}
if ((m2 >= m3) & (m2 >= m1))
{
fm = m2;
if (m1 >= m3)
{
sm = m3;
}
else
{
sm = m3;
}
}
if ((m3 >= m2) & (m3 >= m1))
{
fm = m1;
if (m1 >= m2)
{
sm = m1;
}
else
{
sm = m2;
}
}
avg = (fm+sm) / 2; // error unassinged local variable fm and sm
}
private void txtfi_TextChanged(object sender, EventArgs e)
{
txtam.Text = TotalMarks((txtfi.Text), (txtsi.Text), (txtti.Text)); //error cannot convert string to double
}
private void txtsi_TextChanged(object sender, EventArgs e)
{
txtam.Text = TotalMarks((txtfi.Text), (txtsi.Text), (txtti.Text)); //error cannot convert string to double
}
private void txtti_TextChanged(object sender, EventArgs e)
{
txtam.Text = TotalMarks((txtfi.Text), (txtsi.Text), (txtti.Text)); //error cannot convert string to double
}
}
can any one please help?
Reply
Answers (
3
)
Optional Parameter
SMS Sender