Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 118,309 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,694 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



.ini files

 
Reply to this topicStart new topic

.ini files

bballer1991
post 5 Aug, 2008 - 06:28 PM
Post #1


New D.I.C Head

*
Joined: 5 Aug, 2008
Posts: 1

I am starting to use more and more vb6 instead of vb.net studio 2008.

I am working on a program. I want to use a .ini settings file where the user can set things like admin password and to enable security.

How would I use one of these files with my code.

I know in vb.net you use the settings feature.

User is offlineProfile CardPM

Go to the top of the page


Martyr2
post 5 Aug, 2008 - 07:58 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 4,638



Thanked 120 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Well I strongly suggest that you don't get too hung up on VB6 and continue to practice with .NET since VB6 is dying out.

But as for your question, you have two main options. The first is that you can use API calls from kernel32 like... GetPrivateProfileSectionA(), GetPrivateProfileStringA(), WritePrivateProfileSectionA(), and WritePrivateProfileStringA() or you can build your own (or use someone elses) class file.

The class file might be easier for you since you are first starting out. You can find an instance of such a class at this location...

Reading & Writing to .ini - vb6 - class file included

Hope this helps get you started. smile.gif
User is offlineProfile CardPM

Go to the top of the page

Ken Halter
post 5 Aug, 2008 - 09:12 PM
Post #3


New D.I.C Head

*
Joined: 18 Nov, 2007
Posts: 35



Thanked 4 times
My Contributions


Well, regardless of the "don't use VB6" replies you may find, this is a VB6 forum, so if anything dotNet related answers are off topic.

An INI file doesn't really provide the security you'd need for passwords. Not unless you plan on encrypting them in some way.

As far as INI files go, I've used this class module in several apps and find it's title to be very accurate...

Easy INI File Access
http://www.vbaccelerator.com/home/VB/code/...ess/article.asp

For what it's worth, I still use VB6 100% of the time. The apps I write are based on DLLs and ActiveX Controls we created *years* ago. It would be suicide to our company to attempt to migrate everything to dotNet, especially since there'd be absolutely no benefit.

dotNet is named .Net for a good reason. It's best used for creating web apps. It's still packed with bugs and features that simply don't work. VB6 is the most stable of any language based on BASIC.

The creators of dotNet never even touched "VB" as they all thought it was a "toy". That "toy" help MS become a software giant.

The VB.Net language (people aren't even supposed to call it "VB.Net" anymore... even Microsoft can't decide what to call it) was written by C programmers. Anyone that's written code in C knows that VB and C are *nothing* alike...

You can thank people like Anders Hejlsberg and Paul "I'm the father of Visual Basic" Vick for giving us this mess called VB.Net. I seriously doubt Paul Vick ever had a VB IDE open in his life until self-proclaiming himself "The Father" (what a laugh)

You may be able to tell I'm frustrated by this mess. Since it's an entirely new language, it should have a new name. Simple as that. Unlike all previous versions of BASIC, there's no direct migration path to anything.Net... it's ridiculous to think it's easier to migrate from Quick Basic 4.5 to VB6 than it is to migrate from VB6 to dotNet... the reason is simple. The language designers know nothing about BASIC's history.

So... if you want a truly RAD program development environment, VB6 can't be beat. If you want "glitter and gold" where you're fighting bugs the dotNet guys can't seem to fix (why should they? They're working on VB.Next), go ahead and invest your time/energy in dotNet.

Personally, I'd go with Delphi or any other non-MS language... which frustrates me even further because Delphi (and even COBOL) have dotNet implementations that require very little, if any, code changes... that alone should tell people something about how much MS values your code assets.
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 6 Aug, 2008 - 08:49 PM
Post #4


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 4,638



Thanked 120 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

Well, regardless of the "don't use VB6" replies you may find, this is a VB6 forum, so if anything dotNet related answers are off topic.


I wasn't suggesting that anyone start talking VB.NET here just that they will not want to let VB.NET go to the way side because IT IS dying and has been for the last couple years.


QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

For what it's worth, I still use VB6 100% of the time. The apps I write are based on DLLs and ActiveX Controls we created *years* ago. It would be suicide to our company to attempt to migrate everything to dotNet, especially since there'd be absolutely no benefit.


Then you have a real problem if your company is using nothing but VB6. It is going to have more and more issues with interaction with things and you will quickly find your company behind the times (if it isn't already).

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

dotNet is named .Net for a good reason. It's best used for creating web apps. It's still packed with bugs and features that simply don't work. VB6 is the most stable of any language based on BASIC.


*BEEP* Wrong.... while the framework does bring the old archaic VB into the "internet revolution" with more network objects and libraries, it is still used HEAVILY in windows forms applications. Believe it or not its strength lies in easy to use GUI interfaces which works well with databases. Making VB one of the top choices for database interface design.

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

The creators of dotNet never even touched "VB" as they all thought it was a "toy". That "toy" help MS become a software giant.


This is sooooo wrong on so many levels I don't know how to even address it. VB has always been heavily developed by Microsoft and one of the goals of .NET when it was developed was to bring VB.NET up to speed and keep it part of the "family". Lots of people at Microsoft also deal a lot with VB. Also VB contributed little (along with any language) to MS becoming a giant... it was the Window OS and their deal with IBM that made them the giant.

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

The VB.Net language (people aren't even supposed to call it "VB.Net" anymore... even Microsoft can't decide what to call it) was written by C programmers. Anyone that's written code in C knows that VB and C are *nothing* alike...


I don't know where you heard that it is not to be called VB.NET anymore and often times Microsoft calls it VB.NET or by its full name Visual Basic 2003/2005/2008 etc. And I have no clue why you made the last statement, of course everyone knows that C is nothing like VB. The creators of VB made it that way on purpose. They wanted a language that increased readability and was easier to use and learn. wink2.gif

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

You can thank people like Anders Hejlsberg and Paul "I'm the father of Visual Basic" Vick for giving us this mess called VB.Net. I seriously doubt Paul Vick ever had a VB IDE open in his life until self-proclaiming himself "The Father" (what a laugh)


I know VB5/6 and I know VB.NET since 2003 and I can tell you that hands down I like VB.NET way better than 5/6. (Can anyone say DLL hell?) Not to mention VB6 lacked true object oriented principles, had shitty database access like DAO (in the earlier days of the language), and don't forget not having things like access to web services and just poor code organization. Probably the reason that Microsoft dropped support for this last version of the VB6 (1998) language back in February of this year.

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

You may be able to tell I'm frustrated by this mess. Since it's an entirely new language, it should have a new name. Simple as that. Unlike all previous versions of BASIC, there's no direct migration path to anything.Net... it's ridiculous to think it's easier to migrate from Quick Basic 4.5 to VB6 than it is to migrate from VB6 to dotNet... the reason is simple. The language designers know nothing about BASIC's history.


What the hell are you talking about? The syntax of the language can be traced back to BASIC very easily. It has kept many of the same keywords, classic examples IF condition THEN structure, FOR counter = 0 to N NEXT structure, the use of "AND" and "OR" instead of other languages using && and ||, LEN() came straight from BASIC, same with the functions LEFT, UCASE and STRING not to mention things like the DO LOOP UNTIL has around since then too. If anyone takes a look at some BASIC code they can see the similarities right away.

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

So... if you want a truly RAD program development environment, VB6 can't be beat. If you want "glitter and gold" where you're fighting bugs the dotNet guys can't seem to fix (why should they? They're working on VB.Next), go ahead and invest your time/energy in dotNet.


VB6 is outdated man. Try finding even resources on MSDN for it and you will have to dig a bit (again discontinued as of February 2008). I have helped companies migrate from VB6 to .NET because they were having problems keeping VB6 code afloat. Try doing a search on Google with just "Visual Basic" and tell me how many VB 6 results you find compared to .NET. Not to mention VB6 is a hell of a lot buggier than VB.NET. Oh wait, that reminds me VB6 didn't even have very good error trapping either. So it couldn't even effectively catch all the errors when it has them. I really don't know where you are getting your facts, truly.

QUOTE(Ken Halter @ 5 Aug, 2008 - 09:12 PM) *

Personally, I'd go with Delphi or any other non-MS language... which frustrates me even further because Delphi (and even COBOL) have dotNet implementations that require very little, if any, code changes... that alone should tell people something about how much MS values your code assets.


Well I don't think Delphi is any much better but if you are looking for cross platform compatibility sure go with a non-MS language because everyone knows that they got you locked in to Windows. And with anything that you add to you are going to eventually need to change some code. non-MS languages are not immune to having to change code just to keep it up to date. This is typically called "code rot" and even things that were fine back in the earlier versions of Java now throws warnings to put in error catching for exceptions for more modern versions. Everything changes, it is the nature of technology.

In short, take what this reader has said with a grain of salt. I have pointed out that a large portion of what they have said is not quite true or in some cases just dead wrong. I typically don't flame people this bad but when they go around spreading such blatant lies and misinformation, I feel it my duty to step in and correct it.

To reiterate what I had said at the top, I didn't say just drop VB6 altogether, but just keep in mind that a LARGE portion of the industry has already moved on to .NET and never stop practicing with it. smile.gif
User is offlineProfile CardPM

Go to the top of the page

jakerman999
post 11 Aug, 2008 - 02:39 PM
Post #5


New D.I.C Head

*
Joined: 7 Aug, 2008
Posts: 11



Thanked 1 times
My Contributions


[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
Well, regardless of the "don't use VB6" replies you may find, this is a VB6 forum, so if anything dotNet related answers are off topic.
[/quote]

I wasn't suggesting that anyone start talking VB.NET here just that they will not want to let VB.NET go to the way side because IT IS dying and has been for the last couple years.
[/quote]
here, you're right. VB.net is dying, and has been for the past couple years

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
For what it's worth, I still use VB6 100% of the time. The apps I write are based on DLLs and ActiveX Controls we created *years* ago. It would be suicide to our company to attempt to migrate everything to dotNet, especially since there'd be absolutely no benefit.
[/quote]

Then you have a real problem if your company is using nothing but VB6. It is going to have more and more issues with interaction with things and you will quickly find your company behind the times (if it isn't already).
[/quote]
most of those interaction problems can be worked around. one of the many great things about VB6 is that you can create and modify components(if you know how)

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
dotNet is named .Net for a good reason. It's best used for creating web apps. It's still packed with bugs and features that simply don't work. VB6 is the most stable of any language based on BASIC.
[/quote]

*BEEP* Wrong.... while the framework does bring the old archaic VB into the "internet revolution" with more network objects and libraries, it is still used HEAVILY in windows forms applications. Believe it or not its strength lies in easy to use GUI interfaces which works well with databases. Making VB one of the top choices for database interface design.
[/qoute]
granted, .net does have a fuller GUI, but the graphics needed to display everything uses much more ram space than VB6 and causes development times to be slower if there isn't sufficient ram. not only that, but most of the properties in .net are things that either shouldn't be messed with, or were already in VB6(there are a few exceptions, but not many)

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
The creators of dotNet never even touched "VB" as they all thought it was a "toy". That "toy" help MS become a software giant.
[/quote]

This is sooooo wrong on so many levels I don't know how to even address it. VB has always been heavily developed by Microsoft and one of the goals of .NET when it was developed was to bring VB.NET up to speed and keep it part of the "family". Lots of people at Microsoft also deal a lot with VB. Also VB contributed little (along with any language) to MS becoming a giant... it was the Window OS and their deal with IBM that made them the giant.
[/quote]
the reason windows OS was such a success, was that it was easy to create applications for it, and design your own custom applications if their weren't any out that suited your needs. and let me think... what made it so easy to create applications? I think it was the earlier forms of VB.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
The VB.Net language (people aren't even supposed to call it "VB.Net" anymore... even Microsoft can't decide what to call it) was written by C programmers. Anyone that's written code in C knows that VB and C are *nothing* alike...
[/quote]

I don't know where you heard that it is not to be called VB.NET anymore and often times Microsoft calls it VB.NET or by its full name Visual Basic 2003/2005/2008 etc. And I have no clue why you made the last statement, of course everyone knows that C is nothing like VB. The creators of VB made it that way on purpose. They wanted a language that increased readability and was easier to use and learn. wink2.gif

[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
You can thank people like Anders Hejlsberg and Paul "I'm the father of Visual Basic" Vick for giving us this mess called VB.Net. I seriously doubt Paul Vick ever had a VB IDE open in his life until self-proclaiming himself "The Father" (what a laugh)
[/quote]

I know VB5/6 and I know VB.NET since 2003 and I can tell you that hands down I like VB.NET way better than 5/6. (Can anyone say DLL hell?) Not to mention VB6 lacked true object oriented principles, had shitty database access like DAO (in the earlier days of the language), and don't forget not having things like access to web services and just poor code organization. Probably the reason that Microsoft dropped support for this last version of the VB6 (1998) language back in February of this year.
[/quote]
poor code organization? the way I was taught, programmers should organize the code themselves. if you cram papers into a binder, the binder won't sort them for you, so why should VB sort out code that you cram into it? programming should take effort, not just random typing to get your result.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
You may be able to tell I'm frustrated by this mess. Since it's an entirely new language, it should have a new name. Simple as that. Unlike all previous versions of BASIC, there's no direct migration path to anything.Net... it's ridiculous to think it's easier to migrate from Quick Basic 4.5 to VB6 than it is to migrate from VB6 to dotNet... the reason is simple. The language designers know nothing about BASIC's history.
[/quote]

What the hell are you talking about? The syntax of the language can be traced back to BASIC very easily. It has kept many of the same keywords, classic examples IF condition THEN structure, FOR counter = 0 to N NEXT structure, the use of "AND" and "OR" instead of other languages using && and ||, LEN() came straight from BASIC, same with the functions LEFT, UCASE and STRING not to mention things like the DO LOOP UNTIL has around since then too. If anyone takes a look at some BASIC code they can see the similarities right away.
[/quote]
there are some similarities in the way the code is presented, and in the functions. but the syntax has changed quite a lot, and much more of the code seems more complex to the average user. plus, their is so much garbage in .net, for instance, right in the private sub declarations, it needs to fill the (parenthesis) with data like integers, that serves no purpose, and wastes code space.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
So... if you want a truly RAD program development environment, VB6 can't be beat. If you want "glitter and gold" where you're fighting bugs the dotNet guys can't seem to fix (why should they? They're working on VB.Next), go ahead and invest your time/energy in dotNet.
[/quote]

VB6 is outdated man. Try finding even resources on MSDN for it and you will have to dig a bit (again discontinued as of February 2008). I have helped companies migrate from VB6 to .NET because they were having problems keeping VB6 code afloat. Try doing a search on Google with just "Visual Basic" and tell me how many VB 6 results you find compared to .NET. Not to mention VB6 is a hell of a lot buggier than VB.NET. Oh wait, that reminds me VB6 didn't even have very good error trapping either. So it couldn't even effectively catch all the errors when it has them. I really don't know where you are getting your facts, truly.
[/quote]
the reason there are so many google results for .net is that people can't understand .net code. people need help with it. they seek, and google finds. people could understand VB6 and as such, didn't need to ask for help as much.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
[quote name='Ken Halter' post='395609' date='5 Aug, 2008 - 09:12 PM']
Personally, I'd go with Delphi or any other non-MS language... which frustrates me even further because Delphi (and even COBOL) have dotNet implementations that require very little, if any, code changes... that alone should tell people something about how much MS values your code assets.
[/quote]

Well I don't think Delphi is any much better but if you are looking for cross platform compatibility sure go with a non-MS language because everyone knows that they got you locked in to Windows.
[/quote] as a part time linux user, I know that people are working on creating multiplatform VB imitaions, and the majority use VB6 code with additions to cover the holes. so soon, VB6 code will be cross platform. not really dying out, is it?

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
And with anything that you add to you are going to eventually need to change some code. non-MS languages are not immune to having to change code just to keep it up to date. This is typically called "code rot" and even things that were fine back in the earlier versions of Java now throws warnings to put in error catching for exceptions for more modern versions. Everything changes, it is the nature of technology.
[/quote]
well, Java's not my field, but old code from earlier versions of Java shouldn't need a half hour minimum of work to bring it up to date. unlike the transition from VB6 to .net.
and going backwards is difficult. having code in .net that you want to compile in VB6 takes quite a bit of work.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
In short, take what this reader has said with a grain of salt. I have pointed out that a large portion of what they have said is not quite true or in some cases just dead wrong. I typically don't flame people this bad but when they go around spreading such blatant lies and misinformation, I feel it my duty to step in and correct it.
[/quote]
most of the original post was correct, if it was buried a bit, that's just grammar errors. but the message was true.

[quote name='Martyr2' date='6 Aug, 2008 - 08:49 PM' post='396158']
To reiterate what I had said at the top, I didn't say just drop VB6 altogether, but just keep in mind that a LARGE portion of the industry has already moved on to .NET and never stop practicing with it. smile.gif
[/quote]
well, VB6 is what they teach in schools, so industries that have switched over might be a bit disappointed.

the only real benefit to .net is that you can legally obtain it for free, right from Microsoft, and that really doesn't help much(seeing as you can't compile exe's with it).

edit:why aren't my quotes in quotes?

This post has been edited by jakerman999: 11 Aug, 2008 - 02:46 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/10/08 11:48AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month