Jump to content
  • Advertisement
Sign in to follow this  
AncientHunter

Publishing in vb.net

This topic is 3782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, ive recently created a simple tetris game in vb.net. i want to publish it but after it finishes publishing and installing, when i run it, it gives me an error stating: Image Hosted by ImageShack.us<br/> Can anyone help me here?

Share this post


Link to post
Share on other sites
Advertisement
It looks like you hard coded the path to your highscores file (which isn't wrong per se), and that you hard coded it as an absolute path, which only works on your computer. Try using a relative path instead.

Share this post


Link to post
Share on other sites
How would i do that? sorry bout my limited understanding, this is the only way ive been taught to do this.

My current line of code for this is:

FileSystem.FileOpen(1, Application.StartupPath & "\Highscores.txt", OpenMode.Input)



thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by AncientHunter
How would i do that? sorry bout my limited understanding, this is the only way ive been taught to do this.
My current line of code for this is:
*** Source Snippet Removed ***
thanks

Keep in mind that I am not very familiar with your environment (Mac user myself), but what if you try just using "highscores.txt" as the path? My rationale here is that the app should start with paths relative to the application, and if your code snippet is correct, Application.StartupPath is ending up in some temporary settings directory.

Share this post


Link to post
Share on other sites
You should store such files in the user's own profile area, as you are not usually permitted to write back to the application's own directory unless you are running the application with administrative rights.

You can use the Environment class to work out where to store the data files. For example, this function:

    Private Function GetHighscorePath() As String
' Using IO.Path.Combine allows this code to work on platforms that don't use \ as a directory seperator.
Dim RelativeName As String = IO.Path.Combine("AncientHunter", IO.Path.Combine("Tetris", "Highscores.txt"))
' This bit uses the application data "special folder", which is tied to the current user.
Return IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), RelativeName)
End Function

...returns a filename in the form C:\Users\Ben\AppData\Roaming\AncientHunter\Tetris\Highscores.txt (the exact path depends on the username and version of Windows).

You may need to copy (IO.File.Copy()) a default file there the first time your app is run (use IO.File.Exists() to check first) which could come from the application's own directory. I strongly recommend you take a look at the System.IO namespace, rather than using features such as FileSystem.FileOpen which are provided for backwards compatibility with VB6.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!