Public Class frmNacherfassungZuckerZuckerMRNEingabe

    Sub New(ZuckerMRN)
        InitializeComponent()
        Me.ZuckerMRN = ZuckerMRN
    End Sub

    Public ZuckerMRN = ""


    Private Sub btnFertig_Click(sender As Object, e As EventArgs) Handles btnFertig.Click
        ZuckerMRN = ""
        ZuckerMRN &= txtMRN1.Text
        ZuckerMRN &= txtMRN2.Text
        ZuckerMRN &= txtMRN3.Text
        ZuckerMRN &= txtMRN4.Text

        If Not ZuckerMRN.length = 18 Then
            MsgBox("Format nicht korrekt!" & vbNewLine & "Bitte prüfen Sie die Eingabe.")
            Me.DialogResult = DialogResult.None
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ZuckerMRN = ""
    End Sub

    Private Sub frmNacherfassungZuckerMRNEingabe_Load(sender As Object, e As EventArgs) Handles Me.Load
        txtMRN1.Text = Format(Now, "yy")
        
        If ZuckerMRN.length = 18 Then
            txtMRN1.Text = Mid(ZuckerMRN, 1, 2)
            txtMRN2.Text = Mid(ZuckerMRN, 3, 2)
            txtMRN3.Text = Mid(ZuckerMRN, 5, 13)
            txtMRN4.Text = Mid(ZuckerMRN, 18, 1)
        End If
    End Sub
End Class