Hi there everyone!
I am working on a program where students makes cards with numbers, the program saves them so I can view their work later.
I use a textbox. I type in the name of their file, and their number card is opened, but in the case that the textbox searching is blank, or I mispell the name, I will get a file not found error, and I understand why.
I was just wondering if there was a way so if by some reason I forget to enter a file name, or if the name is incorrect, I would just get a msgbox saying file not found, and have the program not stop?
I use this code to search.
The CardNumberTXT.text is where I search, but is there a way to have an if then statement where if it was blank, or if the file is not found, it would give me a msgbox instead ? THANKS!!
I am working on a program where students makes cards with numbers, the program saves them so I can view their work later.
I use a textbox. I type in the name of their file, and their number card is opened, but in the case that the textbox searching is blank, or I mispell the name, I will get a file not found error, and I understand why.
I was just wondering if there was a way so if by some reason I forget to enter a file name, or if the name is incorrect, I would just get a msgbox saying file not found, and have the program not stop?
I use this code to search.
VB Code:
'This code will load the card numbers NumberList.Clear Dim text As String Open App.Path & "\GeneratedCards\" & CardNumberTXT.text & ".txt" For Input As #1 Do Until EOF(1) Input #1, text NumberList.AddItem text Loop Close #1
The CardNumberTXT.text is where I search, but is there a way to have an if then statement where if it was blank, or if the file is not found, it would give me a msgbox instead ? THANKS!!