Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 3:12 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: calling method to form- displaying textbox data in messagbox
PostPosted: Thu Jun 25, 2009 1:19 am 
Offline
Newbie
User avatar

Joined: Thu Jun 25, 2009 1:03 am
Posts: 2
Has thanked: 0 time
Have thanks: 0 time

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


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: calling method to form- displaying textbox data in messagbox
PostPosted: Fri May 21, 2010 7:29 am 
Offline
Newbie
User avatar

Joined: Sat Jan 17, 2009 7:51 pm
Posts: 13
Has thanked: 0 time
Have thanks: 1 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);
        }
    }



For this message the author orion has received gratitude : msi_333
TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 getting gst, pst total to diplay in my javascript form  Scripting Language  Anonymous  0
 problem with JcheckBox method  Java  Anonymous  1
 Data Encryption Standard (DES)  Finished Projects  msi_333  13
 How to make PHP form data saved into txt file  PHP  Radu  6
 displaying alert box in html  HTML examples  msi_333  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: MSN [Bot] and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team