Ich habe Probleme mit diesem:Ich erhalte eine Fehlermeldung, wenn ein Textfeld aus form1 Aufruf
ich diesen Code haben auf Form2
:
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lbl0, lbl1, lbl11, lbl2, lbl22, lbl3, lbl33, lbl4, lbl44, lbl5, lbl55, lbl6, lbl66, lbl7, lbl77 As New Label
lbl0.Text = "ACCESORIOS"
lbl0.Font = New System.Drawing.Font("MS Reference Sans Serif", 15.75, FontStyle.Bold)
lbl0.Location = New Point(110, 12)
lbl0.AutoSize = True
Me.Controls.Add(lbl0)
lbl1.Text = "Té 180°"
lbl11.Text = Te180
lbl2.Text = "Té 90° Empalme - Codo Triple"
If form1.TextBox3.Text <> 0 Then
lbl22.Text = 0
Else
lbl22.Text = (Int(form1.TextBox1.Text) + Int(form1.TextBox2.Text)) - 1
End If
lbl3.Text = "Soporte 90° T/T"
lbl33.Text = SoporteTT90
TableLayoutPanel1.Controls.Add(lbl33, 0, 0)
End Sub
End Class
Sie die Variablen nicht verwendet nicht stört, oder die single table-layoutpannel adding, da es ein work in progress ist. Wie auch immer, funktioniert dieser Code auch das erste Mal, dass ich es laufen, aber wenn ich Reset drücken,
, die eine Schaltfläche in form1 ist, dass dieses Stück Code enthält:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim frm = New form1
frm.Show()
Me.Close()
Te180 = 0
ContadorGlobal = 0
SoporteTT90 = 0
End Sub
ich mit diesem Fehler am Ende:
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Additional information: Conversion from string "" to type 'Double' is not valid.
ich, dass, wenn das Programm hier durchgeht:
If form1.TextBox3.Text <> 0 Then
lbl22.Text = 0
Else
lbl22.Text = (Int(form1.TextBox1.Text) + Int(form1.TextBox2.Text)) - 1
End If
Jede Hilfe APPRE ist zitiert. Viele Ich rufe form1.textbox1.text nicht korrekt auf. Vielleicht stelle ich es nicht richtig zurück. Ich habe keine Ahnung, da ich kein Experte bin. Danke im Voraus!
Das hat nicht funktioniert: /. Ich erhalte diesen Fehler: Eine nicht behandelte Ausnahme des Typs 'System.InvalidCastException' ist in Microsoft.VisualBasic.dll aufgetreten und weist darauf hin, dass der Fehler hier ist: Wenn form1.TextBox3.Text <> 0 Dann lbl22.Text = 0 Else lbl22.Text = (Int (form1.TextBox1.Text) + Int (form1.TextBox2.Text)) - 1 Ende If –
Auch, wie ich schon sagte. Es funktioniert das erste Mal, wenn ich es ausführe, nachdem ich den Reset-Knopf gedrückt habe, funktioniert es nicht:/ –
Das ist, warum das erste Mal sowohl 'TextBox1.Text' als auch' TextBox2.Text' Wert hat. Ich wette, beim zweiten Mal hat mindestens einer von ihnen seinen Wert verloren und ist leer. – equisde