Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A few more newbie questions

Status
Not open for further replies.

spydermonkey

Programmer
May 24, 2004
31
US
I've been using VB for a few days now and I've come up to a few new questions if anyone has the time.

1) How do you open a file so you can write to it when a button is pushed? I created a meta tag generator which I'd like them to have the ability to save them to their .html files.

2) Is there a less-than-fatal exit or die command? When a field isn't filled in, I have an alert box pop up. But it pops up like 3 times if they miss all three fields. I know I could do this with using many if/else but there must be an easier way. When I use exit, it closes the program! Is there a command to halt it from continuing but NOT kill the program?

Thanks everyone!
 
1. See Open and Print # statements:

open filename for output as #1
print #1, yourstuffhere
...

2. See on error goto or on error resume next statements

first statement in sub:

on error goto abort

your code
...

exit sub

abort:
msgbox "you screwed up!"

end sub

Now these are just an example of how to use the statements, not necessarily proper coding practices.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
See faq222-1694 fro good infromation on error handling.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top