Private Sub SelectButton_Click(ByVal Sender As Object, ByVal e As System.EventArgs) Handles btnSelect.Click Try Dim intSelectedIndex As Int16 = Me.lstAccounts.SelectedIndex ' If nothing is selected, perform search If intSelectedIndex < 0 Then Exit Sub End If ' Get the account number AccountSelected(intSelectedIndex) Catch ex As Exception End Try End Sub Public Sub lstAccounts_DblClick(ByVal Sender As Object, ByVal e As System.EventArgs) Handles lstAccounts.DoubleClick Try Dim intSelectedIndex As Int16 = Me.lstAccounts.SelectedIndex ' If there are no items in the list box, exit and do nothing If intSelectedIndex < 0 Then Exit Sub End If ' Get the account number highlighted AccountSelected(intSelectedIndex) Catch ex As Exception End Try End Sub Private Sub lstAccounts_KeyPress(ByVal Sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles lstAccounts.KeyPress If e.KeyChar = vbCr Then Try Dim intSelectedIndex As Int16 = Me.lstAccounts.SelectedIndex ' If there are no items in the list box, exit and do nothing If intSelectedIndex < 0 Then Exit Sub End If ' Get the account number highlighted AccountSelected(intSelectedIndex) Catch ex As Exception End Try End If End Sub Private Sub AccountSelected(ByVal intSelectedIndex As Int16) Dim strAccountNumber As String Try ' If there are any accounts in list, then set customer ref to be the ' highlighted account no strAccountNumber = CType(Me.lstAccounts.Items.Item(intSelectedIndex), String).Substring(1, 10) Me.strAccountNo = strAccountNumber ' Close the form Me.Close() Catch Ex As Exception End Try End Sub