Jump to content

VB.net code


zonda

Recommended Posts

I was toying in VB.net - in the program I am making, at the form load event, I ask for the user to enter a password. If they try more then 3 times, it will exit on them.

 

 

 


private sub load()

end sub

 

if I replace the me.close with an end, I avoid this problem... but it'd still be nice to know whats causing it for future reference. Any clue?

 

 

 

EDIT: Never mind, working now, had to nest the If statements.

 

 

 

More importantly though - can anyone explain to me how I could enable the user to click a button and have a file open... for instance if they click "open text.txt" it will open the file named text.txt in the containing folders directory??

...

Link to comment
Share on other sites

  • 2 weeks later...

Do you want that file to open ONLY text.txt? Or are you looking to browse for files?

 

 

 

I would assume that it uses the order it searches for files, as long as you don't hard code the file path, would be the pwd, any defined bins, and then the system bins.

Mastermule52.png

The refuge that you built to flee that places that you've come to fear the most ... is the place that you have come to fear the most.

Operator - http://www.heartunit.org

Council - http://z8.invisionfree.com/skillaz

Moderator - http://forum.meebo.com

Link to comment
Share on other sites

Do you want that file to open ONLY text.txt? Or are you looking to browse for files?

 

 

 

I would assume that it uses the order it searches for files, as long as you don't hard code the file path, would be the pwd, any defined bins, and then the system bins.

 

 

 

just the text.txt which would be in the bin folder.

 

 

 

edit - duh, nvm I'm stupid, after writing that I realized what I needed to do.

...

Link to comment
Share on other sites

wait... the text file is in the bin folder??

 

 

 

by bin directories i mean such folders as:

 

C:\windows

 

C:\windows\system32

 

 

 

I should have been more specific by calling it the PATH directories

 

etc...

 

 

 

The pwd (present working directory) is whereever your script runs from.

 

 

 

So say you have your script in c:\scripts\textbuttontester

 

 

 

if you have a c:\scripts\textbuttontester\text.txt it will load that.

 

if you don't have that one, it will look for C:\windows\system32\text.txt

 

if you don't have that one, it will look for C:\windows\text.txt

 

if you don't have that one, it will look for C:\windows\system32\wbem\text.txt

 

if you don't have that one, it should say file not found.

 

 

 

That might be a little different, depending on if you have a different PATH variable than normal, but you get the idea.

 

 

 

edit - awesome - i'll be here if you need more help.

Mastermule52.png

The refuge that you built to flee that places that you've come to fear the most ... is the place that you have come to fear the most.

Operator - http://www.heartunit.org

Council - http://z8.invisionfree.com/skillaz

Moderator - http://forum.meebo.com

Link to comment
Share on other sites

Well here let me explain further - basically within the program I want one of the menu bar items to allow somone to click "about" and it will bring up the readme file.

 

 

 

Rather than open notepad / wordpad, I used the system.io and assigned it to a msgbox - when I compile it, it works fine... but thats only because I know the exact directory it is in on my computer (its in D:\projects) now obviously people are more then likely going to toss the program on their desktop located in on the C drive... so how do I make sure that it always points to the correct spot? v.v

...

Link to comment
Share on other sites

If the contents of the file are simply text, and aren't going to change, why not simply hardcode the text into your app?

Mastermule52.png

The refuge that you built to flee that places that you've come to fear the most ... is the place that you have come to fear the most.

Operator - http://www.heartunit.org

Council - http://z8.invisionfree.com/skillaz

Moderator - http://forum.meebo.com

Link to comment
Share on other sites

If the contents of the file are simply text, and aren't going to change, why not simply hardcode the text into your app?

 

 

 

BLAH, because thats not cooooool. I want to do this as an experiment - obviously I COULD do that, but I dun wanna -.-

...

Link to comment
Share on other sites

try pointing it ti "./text.txt" instead of hardcoding it. That's dot slash text dot txt.

 

 

 

. = present working directory (on unix at least, i don't know it is it the same on dos systems)

Mastermule52.png

The refuge that you built to flee that places that you've come to fear the most ... is the place that you have come to fear the most.

Operator - http://www.heartunit.org

Council - http://z8.invisionfree.com/skillaz

Moderator - http://forum.meebo.com

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.