vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Erstellen von dynamischen Kontextmen?s - wann immer Sie sie brauchen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Allgemeine Diskussionen
Re: pq-Formel automatisieren 
Autor: marie93
Datum: 31.03.11 14:20

Was muss ich hier dran ändern, um auch ungerade Zahlen eingeben zu können?

Option Explicit

Dim a As Double, b As Double, c As Double, Wurzel As Double, x1 As Double, x2 As Double, n1 As Double, n2 As Double, n3 As Double



Private Sub CB_Rechnen_Click()

a = CDbl(TB_a.Text)
b = CDbl(TB_b.Text)
c = CDbl(TB_c.Text)


If a = 0 Then
n1 = a
n2 = b
n3 = c
Wurzel = Runden(Sqr(((b / 2) ^ 2) - c), 2)
If Wurzel > 0 Then
x1 = Runden((-b / 2) - Wurzel, 2)
x2 = Runden((-b / 2) + Wurzel, 2)
If Wurzel = 0 Then
x1 = Runden((-b / 2), 2)
TB_x2.Visible = False
Label_x2.Visible = False
If Wurzel < 0 Then
TB_x1.Visible = False
Label_x1.Visible = False
TB_x2.Visible = False
Label_x2.Visible = False
End If
End If
End If
End If

If a <> 0 Then
n1 = Runden(a / a, 2)
n2 = Runden(b / a, 2)
n3 = Runden(c / a, 2)
Wurzel = Runden(Sqr((((b / a) / 2) ^ 2) - (c / a)), 2)
If Wurzel > 0 Then
x1 = Runden(-b / 2 / a - Wurzel, 2)
x2 = Runden(-b / 2 / a + Wurzel, 2)
If Wurzel < 0 Then
TB_x1.Visible = False
Label_x1.Visible = False
TB_x2.Visible = False
Label_x2.Visible = False
If Wurzel = 0 Then
x1 = Runden(-b / a / 2, 2)
TB_x2.Visible = False
Label_x2.Visible = False
End If
End If
End If
End If


TB_n1.Text = Format(n1)
TB_n2.Text = Format(n2)
TB_n3.Text = Format(n3)
TB_Wurzel.Text = Format(Wurzel)
TB_x1.Text = Format(x1)
TB_x2.Text = Format(x2)


End Sub

Private Sub CB_Ende_Click()

End

End Sub

Private Sub CB_Löschen_Click()

TB_a.Visible = False
TB_b.Visible = False
TB_c.Visible = False
TB_n1.Visible = False
TB_n2.Visible = False
TB_n3.Visible = False
TB_Wurzel.Visible = False
TB_x1.Visible = False
TB_x2.Visible = False

Label_a.Visible = False
Label_b.Visible = False
Label_c.Visible = False
Label_0.Visible = False
Normalform.Visible = False
Wurzel.Visible = False
Label_x1.Visible = False
Label_x2.Visible = False
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label_n0.Visible = False

End Sub

Private Sub CB_Neu_Click()


TB_a.Text = Empty
TB_b.Text = Empty
TB_c.Text = Empty
TB_Wurzel.Text = Empty
TB_x1.Text = Empty
TB_x2.Text = Empty
TB_n1.Text = Empty
TB_n2.Text = Empty
TB_n3.Text = Empty

TB_a.Visible = True
TB_b.Visible = True
TB_c.Visible = True
TB_n1.Visible = True
TB_n2.Visible = True
TB_n3.Visible = True
TB_Wurzel.Visible = True
TB_x1.Visible = True
TB_x2.Visible = True

Label_a.Visible = True
Label_b.Visible = True
Label_c.Visible = True
Label_0.Visible = True
Normalform.Visible = True
Label_Wurzel.Visible = True
Label_x1.Visible = True
Label_x2.Visible = True
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label_n0.Visible = True
End Sub

Function Runden(vZahl As Variant, iStellen As Integer)
Runden = CVar(Format(vZahl * (10 ^ iStellen), "0") / (10 ^ iStellen))
End Function
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
pq-Formel automatisieren2.912marie9325.03.11 05:56
Re: pq-Formel automatisieren1.390ModeratorRalfE25.03.11 09:24
Re: pq-Formel automatisieren1.390marie9325.03.11 21:05
Re: pq-Formel automatisieren1.342Franki26.03.11 05:57
Quadratische Gleichung??2.302Manfred X26.03.11 17:31
Re: pq-Formel automatisieren1.388marie9327.03.11 19:08
Re: pq-Formel automatisieren1.272Franki28.03.11 03:14
Re: pq-Formel automatisieren1.256Manfred X28.03.11 14:15
Re: pq-Formel automatisieren1.297marie9328.03.11 16:52
Re: pq-Formel automatisieren1.316Manfred X28.03.11 17:57
Re: pq-Formel automatisieren1.370Manfred X28.03.11 18:28
Re: pq-Formel automatisieren1.382marie9331.03.11 14:20
Re: pq-Formel automatisieren1.357Manfred X31.03.11 16:41
Re: pq-Formel automatisieren1.401Manfred X31.03.11 17:18
Re: pq-Formel automatisieren1.216marie9306.04.11 15:51
Re: pq-Formel automatisieren1.254marie9306.04.11 20:10
Re: pq-Formel automatisieren1.200Manfred X06.04.11 20:25
Re: pq-Formel automatisieren1.343Franki07.04.11 05:50
Re: pq-Formel automatisieren1.379marie9307.04.11 13:44
Re: pq-Formel automatisieren1.335Manfred X07.04.11 13:53
Re: pq-Formel automatisieren1.376Franki08.04.11 04:30
Re: pq-Formel automatisieren1.242marie9311.04.11 22:10
Re: pq-Formel automatisieren1.446Manfred X12.04.11 10:56
Re: pq-Formel automatisieren1.315Franki13.04.11 03:24

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel