Public Class frmClientLogin Private Sub frmClientLogin_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing If cmbClients.SelectedIndex = -1 Or CLIENT_SELECTED = 99 Then MsgBox("Please select a client from the dropdown-list.", MsgBoxStyle.Exclamation) e.Cancel = True End If End Sub Private Sub frmClientLogin_Load(sender As Object, e As EventArgs) Handles Me.Load Try cmbClients.DataSource = DT_CLIENT_USER cmbClients.DisplayMember = DT_CLIENT_USER.Columns("CLIENT_NAME").ColumnName cmbClients.ValueMember = DT_CLIENT_USER.Columns("CLIENT_ID").ColumnName Catch ex As Exception MsgBox("Unexpected Error in Loading Data: " & ex.Message, MsgBoxStyle.Critical) End Try End Sub Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click If cmbClients.SelectedIndex <> -1 Then CLIENT_SELECTED = cmbClients.SelectedValue Me.Close() Else MsgBox("Please select a client from the dropdown-list.", MsgBoxStyle.Exclamation) Exit Sub End If End Sub End Class