Click here to Skip to main content
15,910,787 members
Home / Discussions / C#
   

C#

 
GeneralExpressions(calculations) Pin
stevemasters2224-May-04 18:46
stevemasters2224-May-04 18:46 
GeneralRe: Expressions(calculations) Pin
sreejith ss nair24-May-04 19:20
sreejith ss nair24-May-04 19:20 
GeneralRe: Expressions(calculations) Pin
stevemasters2224-May-04 19:34
stevemasters2224-May-04 19:34 
GeneralRe: Expressions(calculations) Pin
sreejith ss nair24-May-04 19:54
sreejith ss nair24-May-04 19:54 
GeneralRe: Expressions(calculations) Pin
Stefan Troschuetz24-May-04 21:16
Stefan Troschuetz24-May-04 21:16 
GeneralRe: Expressions(calculations) Pin
sreejith ss nair24-May-04 22:07
sreejith ss nair24-May-04 22:07 
GeneralRe: Expressions(calculations) Pin
Stefan Troschuetz24-May-04 22:38
Stefan Troschuetz24-May-04 22:38 
GeneralRe: Expressions(calculations) Pin
stevemasters2225-May-04 17:09
stevemasters2225-May-04 17:09 
Hi Stefan,

I cant get it working...below is the code....pls help...all I wan't is for textbox3 to = textbox1 + textbox2, when i tab to textbox 3.

SMConfused | :confused:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication5
{
///
/// Summary description for Form1.
///

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 56);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(184, 56);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(112, 104);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 2;
this.textBox3.Text = "";
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void textBox3_TextChanged(object sender, System.EventArgs e)
{
try
{
int labour = int.Parse(textBox1.Text);
int material = int.Parse(textBox2.Text);
textBox3.Text =textBox1+textBox2.ToString();
}
catch (System.FormatException)
{
//handle exceptions by assigning default values for example
}

}
}
}
GeneralRe: Expressions(calculations) Pin
Dave Kreskowiak25-May-04 17:24
mveDave Kreskowiak25-May-04 17:24 
GeneralRe: Expressions(calculations) Pin
stevemasters2225-May-04 17:46
stevemasters2225-May-04 17:46 
GeneralRe: Expressions(calculations) Pin
Dave Kreskowiak26-May-04 0:46
mveDave Kreskowiak26-May-04 0:46 
GeneralRe: Expressions(calculations) [EDITED} Pin
Dave Kreskowiak26-May-04 3:35
mveDave Kreskowiak26-May-04 3:35 
GeneralRe: Expressions(calculations) Pin
Stefan Troschuetz25-May-04 21:25
Stefan Troschuetz25-May-04 21:25 
GeneralExpressions Pin
Anonymous24-May-04 18:37
Anonymous24-May-04 18:37 
GeneralRe: Expressions Pin
sreejith ss nair24-May-04 20:03
sreejith ss nair24-May-04 20:03 
GeneralRe: Expressions Pin
sreejith ss nair24-May-04 20:03
sreejith ss nair24-May-04 20:03 
GeneralRe: Expressions Pin
Dave Kreskowiak25-May-04 0:35
mveDave Kreskowiak25-May-04 0:35 
Generalhelp! Pin
agu989924-May-04 18:14
agu989924-May-04 18:14 
GeneralRe: help! Pin
Heath Stewart25-May-04 2:44
protectorHeath Stewart25-May-04 2:44 
GeneralEnable/Disable of texbox Pin
HappyKim24-May-04 15:56
HappyKim24-May-04 15:56 
GeneralRe: Enable/Disable of texbox Pin
Dave Kreskowiak24-May-04 16:58
mveDave Kreskowiak24-May-04 16:58 
GeneralRe: Enable/Disable of texbox Pin
sreejith ss nair24-May-04 20:02
sreejith ss nair24-May-04 20:02 
GeneralRe: Enable/Disable of texbox Pin
HappyKim25-May-04 15:41
HappyKim25-May-04 15:41 
GeneralRe: Enable/Disable of texbox Pin
sreejith ss nair26-May-04 20:51
sreejith ss nair26-May-04 20:51 
GeneralRe: Enable/Disable of texbox Pin
HappyKim27-May-04 14:01
HappyKim27-May-04 14:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.