Abend,
habe grade angefangen Delphi zu lernen nun habe ich nach einem Workshop ein Taschen Rechner erstellen wollen. Blos das geht nicht so wie ich es möchte....
Hier der Quelltext:
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Projekt1
{
/// <summary>
/// Zusammenfassende Beschreibung für WinForm.
/// </summary>
public class WinForm : System.Windows.Forms.Form
{
/// <summary>
/// Erforderliche Designer-Variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox zahl1;
private System.Windows.Forms.TextBox zahl2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1;
public WinForm()
{
//
// Erforderlich für die Unterstützung des Windows-Form-Designer
//
InitializeComponent();
//
// TODO: Konstruktorcode nach dem Aufruf von InitializeComponent hinzufügen
//
}
/// <summary>
/// Ressourcen nach der Verwendung bereinigen
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer erzeugter Code
/// <summary>
/// Erforderliche Methode zur Unterstützung des Designers -
/// ändern Sie die Methode nicht mit dem Quelltext-Editor
/// </summary>
private void InitializeComponent()
{
this.zahl1 = new System.Windows.Forms.TextBox();
this.zahl2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// zahl1
//
this.zahl1.Location = new System.Drawing.Point(40, 56);
this.zahl1.Name = "zahl1";
this.zahl1.Size = new System.Drawing.Size(80, 20);
this.zahl1.TabIndex = 0;
this.zahl1.Text = "";
//
// zahl2
//
this.zahl2.Location = new System.Drawing.Point(168, 56);
this.zahl2.Name = "zahl2";
this.zahl2.Size = new System.Drawing.Size(80, 20);
this.zahl2.TabIndex = 2;
this.zahl2.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 3;
this.label1.Text = "Zahl1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(168, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 4;
this.label2.Text = "Zahl2";
//
// label3
//
this.label3.Location = new System.Drawing.Point(136, 56);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(16, 16);
this.label3.TabIndex = 5;
this.label3.Text = "+";
//
// label4
//
this.label4.Location = new System.Drawing.Point(40, 88);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 24);
this.label4.TabIndex = 6;
this.label4.Text = "Ergebnis:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(120, 88);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 24);
this.label5.TabIndex = 7;
this.label5.Text = "- keins -";
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 120);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(208, 32);
this.button1.TabIndex = 8;
this.button1.Text = "Rechnen";
//
// WinForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(284, 264);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.zahl2);
this.Controls.Add(this.zahl1);
this.Name = "WinForm";
this.Text = "WinForm";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Der Haupteintrittspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new WinForm());
}
private void button1_Click(object sender, System.EventArgs e)
{
var
zahl1, zahl2, ergebnis, integer;
begin
zahl1:=StrToInt(zahl1.Text);
zahl2:=StrToInt(Zahl2.Text);
ergebnis:=zahl1+zahl2;
label5.Caption:=IntToStr(ergebnis);
end;
end.
}
}
}
Hier der Workshop:
http://www.delphi-treff.de/tutorials...echner/page/1/
Bitte helft mir ich bin total neu. :oops: Und das Programmieren fällt mir momentan schwer da ich eigentlich nur Grafisch gut auskommen kann und mich auch an den Text - Teil gewöhnen möchte. Ich hoffe ihr könnt mir helfen
Wenns noch ginge dann könntet ihr bitte erklären bzw. sagen warum und was ihr geändert habt. Wäre sau cool
Gruß
DJ_Mic