Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

URGENT need of VISUAL BASIC help


  • Please log in to reply

#1
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
Ok, since i have been with GeeksToGo for a while now, and i know you guys won't let me down, since you never have, i will post here. (i didn't post on any other forums :tazz: )

I have a few problems with visual basic.

I am making a game, but that game needs a folder where all the stuff goes into (directory). Now i know how to make it with the:

MkDir ("c:\dir")
command. But i don't know a few very crucial things. How to save preferences and data into that directory, and accessing it later. I even tried to make a database with the visual data manager but i don't know how to access that data through the application that i am writing. Summarizing i have these following problems:

1) I need to know how to save files and how to access them when the user wants to (preferences, names etc)
2) Where i want to save the files, and i want to be able to overwrite them without having error problems (like when a user changes the preferences etc)
3) How to access my database, where to store it, how to place it so that the user can access information.

I know this is a lot and it would really mean a lot to me if one of u geeks:happy: took the time to answer all of this.

Thanks again,
p.s. if you didn't understand something i said post and i will try to explain myself better. :)
- MaverickSidewinder

Edited by MaverickSidewinder, 30 October 2005 - 04:52 PM.

  • 0

Advertisements


#2
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
Hi MaverickSidewinder,

Read all the pages in the following tutorial, its on file operations in VB6:
http://www.developer....co.uk/show/37/

I think it should solve your problems, but if you need further help, you can post back.

P.S.: Dont forget to click Next link on that page. :tazz:
  • 0

#3
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
Can i give you an award? :)

Thank you!!! :tazz:

If i have any more problems relating this topic i will post back!


Thanks again!!
  • 0

#4
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
I read the link and pressed Next ->> but i need to know 2 specific things, and it would help A LOT :tazz: if the code was included.

1) Saving 3 files (.txt format (e.g. T1.txt, T2.txt, T3.txt)) in a new directory. (c:\newdir)
2) Making a textbox (text1.Text) open the T1.txt, and the second (text2.Text) open the T2.txt ecc..
3) A code which will NOT cause an error if the file already exists (since it has to be overwritten when the user saves the game)

Thanks again!
  • 0

#5
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
The answers to all your qustions lie on Page4 of the article:
i.e. : http://www.developer...o.uk/show/37/4/

Edited by darth_ash, 01 November 2005 - 02:16 AM.

  • 0

#6
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts

To get a free file number, you use the FreeFile function:

' Get a free file number
nFileNum = FreeFile

Then, to open the file, we use the Open function. This takes the following syntax:

Open Filename For Method As FileNumber

Filename is the name of the file, Method is Input or Output (there are other methods, and these are discussed later), and FileNumber is a free file number. For example, the following code opens test.txt for Input:

' Get a free file number
nFileNum = FreeFile
' Open Test.txt for input. App.Path returns the path your app is saved in
Open App.Path & "\test.txt" For Input As nFileNum


Ok...but i need to know how to load this file...
Also, i would like to choose the path where to save the file to...(i only tried the App.Path function while testing the program on visual basic and it made a text file called VB98(Vb98=the visual basic version)test.txt in the VB98 folder...if i were to test this program out of visual basic where would it save?)

Im sorry im posting so often... :) Help and code is appreciated (thanks again to darth_ash :tazz: )
  • 0

#7
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
The App.Path property returns the path from which the application itself was executed.
So when you Make your final exe and then run it; yes, the file will be opened from where the final exe file for your program was loacted.

Im sorry im posting so often... :) Help and code is appreciated (thanks again to darth_ash :) )


Its not a crime to post more on GTG :woot:, you can post how much ever you want, thats what this site is for: To help you out. :tazz:
Also, can you be more specific about what code I should help you with? Should I help you with full file handling coding, or just a part of it?
Though its no problem for me to give you the full code, it will be much better for you(make you a better programmer) if you give a try first and then if you have any problems, I'll help you out.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP