Public Class usrcntlRechnungsbestaetigung
    Implements FormualrInterface

    Public Event CHANGED(name, value)
    Public Event KDNR_CHANGED(kdnr)
    Public Event DELETE(c As Control)
    Public Event MOVE_UP(c As Control)
    Public Event MOVE_DOWN(c As Control)

    Public KdNR As Integer = -1
    Public Sub ChangeKDNr(kdnr As Integer) _
       Implements FormualrInterface.ChangeKDNr
        'initKdNR(kdnr)
        txtVersender.KdNr = kdnr
    End Sub

    Sub initControlsHandler()
        For Each c In Me.Controls
            Select Case c.GetType.ToString
                Case GetType(VERAG_PROG_ALLGEMEIN.MyTextBox).ToString
                    AddHandler DirectCast(c, VERAG_PROG_ALLGEMEIN.MyTextBox).Leave, Sub()
                                                                                        RaiseEvent CHANGED(c.name, c.text)
                                                                                    End Sub
                Case GetType(VERAG_PROG_ALLGEMEIN.MyComboBox).ToString
                    AddHandler DirectCast(c, VERAG_PROG_ALLGEMEIN.MyComboBox).SelectedIndexChanged, Sub()
                                                                                                        RaiseEvent CHANGED(c.name, c._value)
                                                                                                    End Sub
                Case GetType(TextBox).ToString
                    AddHandler DirectCast(c, TextBox).Leave, Sub()
                                                                 RaiseEvent CHANGED(c.name, c.text)
                                                             End Sub
            End Select
        Next
    End Sub

    Private Sub btnDel_Click(sender As Object, e As EventArgs) Handles btnDel.Click
        RaiseEvent DELETE(Me)
    End Sub

    Private Sub btnup_Click(sender As Object, e As EventArgs) Handles btnUp.Click
        RaiseEvent MOVE_UP(Me)
    End Sub

    Private Sub btnDown_Click(sender As Object, e As EventArgs) Handles btnDown.Click
        RaiseEvent MOVE_DOWN(Me)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub usrcntlVollmacht_AT_Load(sender As Object, e As EventArgs) Handles Me.Load

        txtVersender.initKdBox(Me.FindForm)

        initControlsHandler()
        cboSprache.Items.Clear()
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Deutsch", "DE"))
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Englisch", "EN"))
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Französisch", "FR"))
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Türkisch", "TR"))

        If KdNR > 0 Then txtVersender.KdNr = KdNR

        '  cboFiliale.fillWithSQL(" SELECT FilialenNr, Grenzstelle FROM Filialen WHERE Fil_Status='A' ORDER BY FilialenNr ", , "FMZOLL", True)

        '    txtBearbeiter.Text = If(VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME, "")



    End Sub

    Private Sub pic_Click(sender As Object, e As EventArgs) Handles pic.Click
        FormularManagerNEU.genPDF(Me, True)
    End Sub



    Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
        FormularManagerNEU.genPDF(Me, , , , True)
    End Sub
End Class
