Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > PLEASE HELP!!!!
 

PLEASE HELP!!!!

Hi to all!....

i just got started at a company and my first assignment is to make an application that manipulates payroll values for employees.

i have created 3 tables in my companie's ms sql server.

i want now to create an ini file ,so that when i start the application,i won't have to give again the datasource name,database name,uid and password.how can i do this?


chriskrikonis  Thursday, April 03, 2008 7:44 AM

Hi chris,

You want to create .INI File, this file is nothing but a file which stores information, so if you check your system you will find many .ini files. you can also open this file in notepad as it is a text file.

Thats enough with the .Ini file information, now the creation of it,

As i said its a text file, you will create a text file using IO.File class, CreateText() function, you have to provide a path with the file name as a parametr to this function and you will give the file name as Filename.INI, don't forget .ini extension.

If you still hve doubt you can have a look at help on IO.File.

This will create the .ini file for you, now you can write your data using the same IO.File class, but i'll won't suggest you to create the .ini file as it can be opened easily by anyone and the information stored will be known to others.

You can ask your PM to suggest the alternate option of storing information. If this is for internal use only then i guess you can go ahead, but still you confirm it with your PM.

All the best for your future asignments.

If you need any other help do let me know.

Hope this information helps you.

Regards,

Rushabh D. Vipani.

Ruvi  Thursday, April 03, 2008 10:16 AM

HI,

From VB.NET to VB6.... backwards strange . Neways no problem.

In Vb6 also you have to create the text File, but way of creating is different, here you have to use FileSystemObject class. (Add it as a reference, called Scriplet Runtime 1.0 or something like that you hve to chk it as i don't have vb6 installed on my office system). After this you create an object of FileSystemObject and use function called createTextFile(), here it will hve the path parameter and other parameter, its upto you to give other parameters as it is optional.

Thats it the .ini file is ready to be used.

Then for writing the file you have to write as given below:

Code Snippet

Dim ts as textstream

Dim fs as new FileSystemobject

dim str as string

str = "<YOUR DATA TIO WRITE>"

fs.createtextfile(<PATH>)

set ts = fs.opentextFile(<PATH>)

ts.write str

ts.close

NOTE: This is just the rough code, might not work properly.

Try this, if you still have ne other doubts do let me know.

Regards,

Rushabh D. Vipani.

Ruvi  Thursday, April 03, 2008 12:12 PM

Hi chris,

You want to create .INI File, this file is nothing but a file which stores information, so if you check your system you will find many .ini files. you can also open this file in notepad as it is a text file.

Thats enough with the .Ini file information, now the creation of it,

As i said its a text file, you will create a text file using IO.File class, CreateText() function, you have to provide a path with the file name as a parametr to this function and you will give the file name as Filename.INI, don't forget .ini extension.

If you still hve doubt you can have a look at help on IO.File.

This will create the .ini file for you, now you can write your data using the same IO.File class, but i'll won't suggest you to create the .ini file as it can be opened easily by anyone and the information stored will be known to others.

You can ask your PM to suggest the alternate option of storing information. If this is for internal use only then i guess you can go ahead, but still you confirm it with your PM.

All the best for your future asignments.

If you need any other help do let me know.

Hope this information helps you.

Regards,

Rushabh D. Vipani.

Ruvi  Thursday, April 03, 2008 10:16 AM
thanks a lot.i will check it out and let you know.

chriskrikonis  Thursday, April 03, 2008 10:41 AM
can you guide me somehow to do that in vb6??

chriskrikonis  Thursday, April 03, 2008 11:38 AM

HI,

From VB.NET to VB6.... backwards strange . Neways no problem.

In Vb6 also you have to create the text File, but way of creating is different, here you have to use FileSystemObject class. (Add it as a reference, called Scriplet Runtime 1.0 or something like that you hve to chk it as i don't have vb6 installed on my office system). After this you create an object of FileSystemObject and use function called createTextFile(), here it will hve the path parameter and other parameter, its upto you to give other parameters as it is optional.

Thats it the .ini file is ready to be used.

Then for writing the file you have to write as given below:

Code Snippet

Dim ts as textstream

Dim fs as new FileSystemobject

dim str as string

str = "<YOUR DATA TIO WRITE>"

fs.createtextfile(<PATH>)

set ts = fs.opentextFile(<PATH>)

ts.write str

ts.close

NOTE: This is just the rough code, might not work properly.

Try this, if you still have ne other doubts do let me know.

Regards,

Rushabh D. Vipani.

Ruvi  Thursday, April 03, 2008 12:12 PM

You can use google to search for other answers

Custom Search

More Threads

• Programatically select items in ListBox
• How can I make a listview look and behaive like a combobox
• Embeding a Schema as a resource
• Code Reuse/ Form instances & modules
• Change connectionstring thru my.setting
• Location Change And Resizing Compunents
• bin
• display selected auto fllter at foot of column
• Default Web Browser
• I need a Serialnumber from the PC.