
December 22nd, 2010, 11:33 AM
|
Registered User
|
|
Join Date: Dec 2010
Posts: 1
Time spent in forums: 43 m 53 sec
Reputation Power: 0
|
|
What does it mean in C# ? Cannot implicitly convert type 'string' to 'System.EventArg
I'm programming a calculator in visual C#.net for my high school's homework and I'm badly in need of help.
It's my program without code of numbers:
(btnP = +, btnZ = *, btnS = -, btnT=/)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Calculator
{
public partial class Form1 : Form
{
int x, y, c,d;
string e;
public Form1()
{
InitializeComponent();
}
private void btnE_Click(object sender, EventArgs e)
{
if (d==1)
{
y = Convert.ToInt32(textBox1.Text);
c = x + y;
e = Convert.ToString(c);
textBox1.Text += e ;
}
if (d == 2)
{
y = Convert.ToInt32(textBox1.Text);
c = x * y;
e = Convert.ToString(c)
textBox1.Text += e;
}
if (d == 3)
{
y = Convert.ToInt32(textBox1.Text);
c = x - y;
e = Convert.ToString(c);
textBox1.Text += e;
}
if (d == 4)
{
y = Convert.ToInt32(textBox1.Text);
c = x / y;
e = Convert.ToString(c);
textBox1.Text += e;
}
}
private void btnP_Click(object sender, EventArgs e)
{
d = 1;
x = Convert.ToInt32(textBox1.Text);
textBox1.Text = "";
}
private void btnZ_Click(object sender, EventArgs e)
{
d = 2;
x = Convert.ToInt32(textBox1.Text);
textBox1.Text = "";
}
private void btnN_Click(object sender, EventArgs e)
{
d = 3;
x = Convert.ToInt32(textBox1.Text);
textBox1.Text = "";
}
private void btnT_Click(object sender, EventArgs e)
{
d = 4;
x = Convert.ToInt32(textBox1.Text);
textBox1.Text = "";
}
}
}
This program has error in all parts witch is wrote Convert.ToString(c);
It's error:
Cannot implicitly convert type 'string' to 'System.EventArgs'
What's the problem?What should I do?
please help me !
|