You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.8 KiB

Imports System.Windows.Forms
Public Class frmPerson
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub frmPerson_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Me.Tag = "add" Then
Me.Text = "Gast hinzufügen"
ElseIf Me.Tag = "edit" Then
Me.Text = "Gast bearbeiten"
End If
'Dim dt As DataTable = GästeDataSet.Tables("Länder")
'Dim dr As DataRow = dt.NewRow()
'With dr
'.Item("Land") = 'unfinished
'End With
'cboLand.Items.Add("Neues Land eintragen")
End Sub
Private Sub cboLand_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboLand.SelectedIndexChanged
If cboLand.Text = "Neues Land eintragen" Then
Dim NeuesLand As String = InputBox("Name des neuen Landes:", "Neues Land eintragen")
If NeuesLand <> "" Then
' eintragen
If Not cboLand.Items.Contains(NeuesLand) Then
Dim Anzahl As Integer = cboLand.Items.Count
cboLand.Items.Insert(Anzahl - 1, NeuesLand.ToString)
cboLand.Text = NeuesLand.ToString
Else
MsgBox("Tut mir leid, das Land ist doch schon in der Liste!")
Exit Sub
End If
Else
' abbruch
Exit Sub
End If
End If
End Sub
End Class