Dim lst As WinForm.ListBox = e.Form.Controls("ListBox1") If lst.SelectedIndex >=0 Then Dim UserName As String = lst.SelectedItem Dim cmd As New SQLCommand cmd.ConnectionName = "User" cmd.CommandText = "Delete From {Users} Where [Name] = '" & UserName & "'" cmd.ExecuteNonQuery lst.Items.RemoveAt(lst.SelectedIndex) End If