Imports System.Windows.Forms

Public Class frmZEButtons

    Dim art As String
    Dim firma As String()
    Public resultCode As Integer = -1

    Sub New(art As String, _Firma As String)
        Me.art = art
        Me.firma = Split(_Firma, ",")
        InitializeComponent()
    End Sub

    Private Sub btnZEKommen_Click(sender As Object, e As EventArgs) Handles btnIMEXKommen.Click, btnIMEXGehen.Click, btnATTGehen.Click, btnATTKommen.Click, btnVergGehen.Click, btnVergKommen.Click, btnFOGehen.Click, btnFOKommen.Click, btnAMBARKommen.Click, btnAMBARKommen.Click
        Select Case sender.name
            Case "btnIMEXKommen" : resultCode = 19
            Case "btnIMEXGehen" : resultCode = 19
            Case "btnATTKommen" : resultCode = 18
            Case "btnATTGehen" : resultCode = 18
            Case "btnVergKommen" : resultCode = 0
            Case "btnVergGehen" : resultCode = 0
            Case "btnFOKommen" : resultCode = 20
            Case "btnFOGehen" : resultCode = 20
            Case "btnAMBARKommen" : resultCode = 23
            Case "btnAMBAGehen" : resultCode = 23
        End Select
    End Sub

    Private Sub frmZEButtons_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Select Case art
            Case "in"
                If firma IsNot Nothing AndAlso firma.Length > 0 Then

                    If firma.Contains("ATILLA") Then btnATTKommen.Enabled = True
                    If firma.Contains("IMEX") Then btnIMEXKommen.Enabled = True
                    If firma.Contains("FO") Then btnFOKommen.Enabled = True
                    If firma.Contains("VERAG") Then btnVergKommen.Enabled = True
                    If firma.Contains("AMBAR") Then btnAMBARKommen.Enabled = True

                End If

            Case "out"

                If firma IsNot Nothing AndAlso firma.Length > 0 Then

                    If firma.Contains("ATILLA") Then btnATTGehen.Enabled = True
                    If firma.Contains("IMEX") Then btnIMEXGehen.Enabled = True
                    If firma.Contains("FO") Then btnFOGehen.Enabled = True
                    If firma.Contains("VERAG") Then btnVergGehen.Enabled = True
                    If firma.Contains("AMBAR") Then btnABMARGehen.Enabled = True

                End If

            Case Else

        End Select

        Me.TopMost = True

    End Sub


    Private Sub frmZEButtons_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then Me.Close()
    End Sub
End Class