hehe ok *cosmo * =))
hier , kannst ja mal zum spass einfügen in .NET ! dann siehst an was ich grad rummach !
weil hab soeben eine neue Aufgabenstellung bekommen ! läuft nicht richtig...
naja ich programmiere jetzt erst seit 3 tagen

hab echt noch probs ! naja.. hier kannst ja mal schau n , und zwar muss ich es mit einer Fehlerbox machn! leider...
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Vom Windows Form Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
InitializeComponent()
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
End Sub
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Für Windows Form-Designer erforderlich
Private components As System.ComponentModel.IContainer
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich
'Sie kann mit dem Windows Form-Designer modifiziert werden.
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents TxtEingabe1 As System.Windows.Forms.TextBox
Friend WithEvents TxtEingabe2 As System.Windows.Forms.TextBox
Friend WithEvents btnsub As System.Windows.Forms.Button
Friend WithEvents btnadd As System.Windows.Forms.Button
Friend WithEvents btnmulti As System.Windows.Forms.Button
Friend WithEvents btndivi As System.Windows.Forms.Button
Friend WithEvents Txtergebnis As System.Windows.Forms.TextBox
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents mldFehler As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.TxtEingabe1 = New System.Windows.Forms.TextBox()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.TxtEingabe2 = New System.Windows.Forms.TextBox()
Me.btnsub = New System.Windows.Forms.Button()
Me.btnadd = New System.Windows.Forms.Button()
Me.btnmulti = New System.Windows.Forms.Button()
Me.btndivi = New System.Windows.Forms.Button()
Me.Txtergebnis = New System.Windows.Forms.TextBox()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.mldFehler = New System.Windows.Forms.TextBox()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox3.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.TxtEingabe1})
Me.GroupBox1.Location = New System.Drawing.Point(16, 24)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Zahl 1"
'
'TxtEingabe1
'
Me.TxtEingabe1.Location = New System.Drawing.Point(24, 32)
Me.TxtEingabe1.Name = "TxtEingabe1"
Me.TxtEingabe1.Size = New System.Drawing.Size(144, 20)
Me.TxtEingabe1.TabIndex = 2
Me.TxtEingabe1.Text = ""
'
'GroupBox2
'
Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.TxtEingabe2})
Me.GroupBox2.Location = New System.Drawing.Point(304, 24)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Zahl 2"
'
'TxtEingabe2
'
Me.TxtEingabe2.Location = New System.Drawing.Point(24, 32)
Me.TxtEingabe2.Name = "TxtEingabe2"
Me.TxtEingabe2.Size = New System.Drawing.Size(144, 20)
Me.TxtEingabe2.TabIndex = 3
Me.TxtEingabe2.Text = ""
'
'btnsub
'
Me.btnsub.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnsub.Location = New System.Drawing.Point(112, 152)
Me.btnsub.Name = "btnsub"
Me.btnsub.Size = New System.Drawing.Size(56, 40)
Me.btnsub.TabIndex = 2
Me.btnsub.Text = "-"
'
'btnadd
'
Me.btnadd.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnadd.Location = New System.Drawing.Point(192, 152)
Me.btnadd.Name = "btnadd"
Me.btnadd.Size = New System.Drawing.Size(56, 40)
Me.btnadd.TabIndex = 3
Me.btnadd.Text = "+"
'
'btnmulti
'
Me.btnmulti.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnmulti.Location = New System.Drawing.Point(272, 152)
Me.btnmulti.Name = "btnmulti"
Me.btnmulti.Size = New System.Drawing.Size(56, 40)
Me.btnmulti.TabIndex = 4
Me.btnmulti.Text = "*"
'
'btndivi
'
Me.btndivi.Cursor = System.Windows.Forms.Cursors.Hand
Me.btndivi.Location = New System.Drawing.Point(352, 152)
Me.btndivi.Name = "btndivi"
Me.btndivi.Size = New System.Drawing.Size(56, 40)
Me.btndivi.TabIndex = 5
Me.btndivi.Text = "/"
'
'Txtergebnis
'
Me.Txtergebnis.BackColor = System.Drawing.SystemColors.ActiveBorder
Me.Txtergebnis.Location = New System.Drawing.Point(8, 32)
Me.Txtergebnis.Name = "Txtergebnis"
Me.Txtergebnis.Size = New System.Drawing.Size(184, 20)
Me.Txtergebnis.TabIndex = 6
Me.Txtergebnis.Text = ""
'
'GroupBox3
'
Me.GroupBox3.Controls.AddRange(New System.Windows.Forms.Control() {Me.Txtergebnis})
Me.GroupBox3.Location = New System.Drawing.Point(168, 216)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.TabIndex = 7
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "Ergebnis:"
'
'mldFehler
'
Me.mldFehler.Location = New System.Drawing.Point(88, 344)
Me.mldFehler.Name = "mldFehler"
Me.mldFehler.Size = New System.Drawing.Size(352, 20)
Me.mldFehler.TabIndex = 8
Me.mldFehler.Text = ""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(528, 398)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.mldFehler, Me.GroupBox3, Me.btndivi, Me.btnmulti, Me.btnadd, Me.btnsub, Me.GroupBox2, Me.GroupBox1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Public Function subtrahiere(ByVal a As Double, ByVal b As Double) As Double
subtrahiere = a - b
End Function
Private Sub btnsub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsub.Click
Dim zahl1 As Double
Dim zahl2 As Double
Dim zahl3 As Double
If IsNumeric(TxtEingabe1.Text) Then
zahl1 = Me.TxtEingabe1.Text
Else
mldFehler.Text = ("falsche Eingabe in feld1")
Me.TxtEingabe1.Text = ""
End If
If IsNumeric(TxtEingabe2.Text) Then
zahl2 = Me.TxtEingabe2.Text
Else
mldFehler.Text = ("falsche Eingabe in feld2")
Me.TxtEingabe2.Text = ""
End If
zahl3 = subtrahiere(zahl1, zahl2)
Txtergebnis.Text = zahl3
End Sub
Public Function addiere(ByVal a As Double, ByVal b As Double) As Double
addiere = a + b
End Function
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
Dim zahl1 As Double
Dim zahl2 As Double
Dim zahl3 As Double
If IsNumeric(TxtEingabe1.Text) Then
zahl1 = Me.TxtEingabe1.Text
Else
mldFehler.Text = ("falsche Eingabe in feld1")
Me.TxtEingabe1.Text = ""
End If
If IsNumeric(TxtEingabe2.Text) Then
zahl2 = Me.TxtEingabe2.Text
Else
mldFehler.Text = ("falsche Eingabe in feld2")
Me.TxtEingabe2.Text = ""
End If
zahl3 = addiere(zahl1, zahl2)
Txtergebnis.Text = zahl3
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Public Function multipliziere(ByVal a As Double, ByVal b As Double) As Double
multipliziere = a * b
End Function
Private Sub btnmulti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmulti.Click
Dim zahl1 As Double
Dim zahl2 As Double
Dim zahl3 As Double
If IsNumeric(TxtEingabe1.Text) Then
zahl1 = Me.TxtEingabe1.Text
Else
mldFehler.Text = ("falsche Eingabe in feld1")
Me.TxtEingabe1.Text = ""
End If
If IsNumeric(TxtEingabe2.Text) Then
zahl2 = Me.TxtEingabe2.Text
Else
mldFehler.Text = ("falsche Eingabe in feld2")
Me.TxtEingabe2.Text = ""
End If
zahl3 = multipliziere(zahl1, zahl2)
Txtergebnis.Text = zahl3
End Sub
Public Function dividiere(ByVal a As Double, ByVal b As Double) As Double
dividiere = a / b
End Function
Private Sub btndivi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndivi.Click
Dim zahl1 As Double
Dim zahl2 As Double
Dim zahl3 As Double
If IsNumeric(TxtEingabe1.Text) Then
zahl1 = Me.TxtEingabe1.Text
Else
mldFehler.Text = ("falsche Eingabe in feld1")
Me.TxtEingabe1.Text = ""
End If
If IsNumeric(TxtEingabe2.Text) Then
zahl2 = Me.TxtEingabe2.Text
Else
mldFehler.Text = ("falsche Eingabe in feld2")
Me.TxtEingabe2.Text = ""
End If
zahl3 = dividiere(zahl1, zahl2)
Txtergebnis.Text = zahl3
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End
End Sub
Private Sub mldFehler_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mldFehler.TextChanged
Me.mldFehler.BackColor = System.Drawing.Color.Red
Me.mldFehler.ForeColor = System.Drawing.Color.White
If IsNumeric(TxtEingabe1.Text) Then
mldFehler.Text = ""
End If
End Sub
End Class