- #1
B
Black Panter
Bekanntes Mitglied
Themenersteller
- Dabei seit
- 20.07.2005
- Beiträge
- 138
- Reaktionspunkte
- 0
bei folgendem code
wird mir
was is and em code falsch?
die bezeichnungen stimmen alle.
com_state ist eine Combobox
txt_input ist eine TextBox
lbl_output ist Label
und cmd_button ist ein Button
Code:
Public Class Form1
Public Function Round(ByVal Number As Double, _
ByVal Digits As Integer) As Double
Round = Int(Number * 10 ^ Digits + 0.5) / 10 ^ Digits
End Function
Private Sub Button1_Click()
Dim com_state, lbl_output, txt_input As Object
Dim speed, indexzahl, way, state, speed_input As Single
Dim zustand(4) As String
zustand(0) = 1
zustand(1) = 0.5
zustand(2) = 0.35
zustand(3) = 0.15
indexzahl = com_state.ListIndex
state = zustand(indexzahl)
speed_input = txt_input.Text / 3.6
If Not IsNumeric(speed) Then
MsgBox(Falsche Eingabe)
GoTo theEnd
Else
way = Round((speed ^ 2) / (2 * 12 * state), 5)
If speed < 0 Or speed > 400 Then
MsgBox(speed & km/h ist keine gültige Eingabe! Der wert muss zwischen 0 und 400 km/h liegen!)
Else
If way < 1 Then
lbl_output.Caption = Der Bremsweg beträgt & Round(way * 100, 2) & cm
Else : lbl_output.Caption = Der Bremsweg beträgt & Round(way, 2) & m
End If
End If
End If
theEnd:
End Sub
End Class
Code:
Warnung 1 Die com_state-Variable wird verwendet, bevor ihr ein Wert zugewiesen wird. Zur Laufzeit kann eine Nullverweisausnahme auftreten. D:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Visual Studio 2005\Projects\Form1.vb 17 21 Bremswegrechner
was is and em code falsch?
die bezeichnungen stimmen alle.
com_state ist eine Combobox
txt_input ist eine TextBox
lbl_output ist Label
und cmd_button ist ein Button