Question Locked

Visual Basic 2010 Express

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I created a ListView in VB2010 Express. I have four buttons on Form1 to add an item, delete an item, edit an item and print the list. Before I can edit or delete an item, the item must first be selected. If I forget to first select and item before clicking either the edit or delete button, I get an error message.

What code do I need to add so that when I forget to select before clicking the edit or delete button a message box will remind to first select. I added the message box but after clicking OK on the message box, the code continues and I still get the error message. I need something to pause the code long enough for me to select the item and re-click.

Thank you very much.

RoyBonBon

3 replies

by roybonbon

on the line before where the code is reporting an error enter:
On error goto Handler

On the last line of the Sub routine just before End Sub enter:
Handler: msgbox ("Please Select an item before Clicking the Edit Button")

type Exit Sub on the last line of code before typing the Handler: info

This discussion is closed to new replies.