Thu Jun 25, 2009 1:19 am
Public class MyDerivedClass : MyBaseClass
{
public override int Calculate()
{
return numberOne * numberTwo;
}
I call the method in button command:
private void button1_Click(object sender, EventArgs e)
{
MyDerivedClass mdc = new MyDerivedClass();
mdc.SumAll();
Question: I have two text boxes on form and one button.
I want to input numbers in textboxes and click button to displaytotal in a messagebox.
I have tried:
myDerivedClass mdc = new myDerivedClass();
int total = mdc.calculate();
total=(int.Parse(textBox1.Text)) + (int.Parse(textBox2.Text));
MessageBox.Show(total.ToString());
Fri May 21, 2010 7:29 am
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 sHow_in_Messagebox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int total = Convert.ToInt32(textBox1.Text)+Convert.ToInt32(textBox2.Text);;
MessageBox.Show(String.Format("This is Your Total Number {0}",total),"Show",MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.