Public Class usrCntlAllg
    Public kdNr As Integer = -1
    Public SDLNr As String = ""
    Public History As String = ""
    Public Event LKWChanged(newKfz As String)
    Private Sub lblLKWNr_TextChanged(sender As Object, e As EventArgs) Handles lblLKWNr.TextChanged
        txtVermerk.Text = ""
        Dim kundenSQL As New kundenSQL
        Dim dt As DataTable = kundenSQL.loadDgvBySql("SELECT isnull([Verkauft],0) as Verkauft,  isnull([Abgemeldet],0) as Abgemeldet,isnull(Vermerk,'') as Vermerk, isNull(KZAenderung,0) as KZAenderung FROM [LKW] WHERE [KundenNr]=" & kdNr & " AND [KfzKennzeichen]='" & lblLKWNr.Text & "' ")
        If dt.Rows.Count > 0 Then
            lblLKWverkauft.Visible = dt(0)("Verkauft")
            lblLKWabgemeldet.Visible = dt(0)("Abgemeldet")
            lblKZAenderung.Visible = dt(0)("KZAenderung")
            txtVermerk.Text = dt(0)("Vermerk")
        End If
    End Sub

    Private Sub FlatButton1_Click(sender As Object, e As EventArgs) Handles FlatButton1.Click
        Dim f As New frmChangeLKW

        f.OldLkW = lblLKWNr.Text
        f.SDLNr = SDLNr
        f.History = History
        f.kundenNr = kdNr
        If f.ShowDialog(Me) = DialogResult.OK Then
            RaiseEvent LKWChanged(f.newKFZ)
        End If
    End Sub
End Class
