Total members 11889 |It is currently Thu Mar 28, 2024 10:45 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Hello,
have a ovveride method:
Code:
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()); 

but I am not sure I am realy calling the method doing it this way-
any ideas
thank you




Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

Hi,
May be help this code.
Code:


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 senderEventArgs e)
        {
            
int total Convert.ToInt32(textBox1.Text)+Convert.ToInt32(textBox2.Text);;
            
MessageBox.Show(String.Format("This is Your Total Number {0}",total),"Show",MessageBoxButtons.OKMessageBoxIcon.Information);
        }
    }



Author:
Newbie
User avatar Posts: 12
Have thanks: 1 time

For this message the author orion has received gratitude : DrRakha
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : calling method to form- displaying textbox data in messagbox
 Calling a Private Method in jsp     -  
 Calling an Overridden Method in php     -  
 add data from form1 textbox to form2 combo box     -  
 Displaying images from database instead of the url from data     -  
 Send data without a form     -  
 How to make PHP form data saved into txt file     -  
 form to insert data, upload many files and images , database     -  
 Earn $2 Per Form Filled. Now Hiring Data Entry Typists     -  
 AutoComplete TextBox     -  
 how to show hashmap value in a textbox     -  



Topic Tags

C# Forms
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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