Visual Basic 6 - is it Object Oriented only?

I’m seriously thinking about getting back into some Windows Programming using the Win API.I’ve heard VB 6 (not the .NET stuff) is the tool of choice for that. I have experience with BasicA and GWBasic from the mid 1980’s.

I’m old school linear programming with twenty plus years experience. I’d prefer programming VB that way if it will let me. Do you have to learn object programming to use VB?

I use NetExpress COBOL 85 at work. It supports old school programming and also object oriented. But, I’ve never touched the object stuff. It has an IDE environment that I’ve been told is almost identical to VB 6. I love being able to compile, debug within the IDE environment. The debugger is one of the best I’ve seen since leaving the Vax VMS environment. Vax had a kick ass two screen debugger way back in 1990. Years before it was available on PC’s.

I’ve taken several two/three day seminars on C++. I just find such low level programming irritating. Unless you want to screw around reading files a byte at a time. I’m a business programmer at heart. But, I do enjoy some systems programming. I used Fortan 77 on the Vax for several years. I’ve also programmed in PL1 in school.

I can learn a new language pretty easily. But, refuse to throw away 20 years experience to start as a object oriented newbie.

I am not aware of any object oriented programming languages that don’t use an underlying procedural language. How easy it is to use it to do something useful, I have no idea.

Programmer here, 5 years in .NET (combination of VB.NET and C#), schooled in C++, with experience in several platforms, including ColdFusion, Java, and VB6.

Don’t use VB6. It’s imperfectly OOP, it has the worst of both worlds. It’s object handling addressing methods are bizaare (there is a difference between saying x=<something> and set x=<something>), it’s error handling is primitive and GOTO based, and the associated Visual Studio version that comes with a standard installation is primitive.

I’d strongly reccomend a .NET based Winforms solution. It doesn’t have as much of the low level Win API as VB6 or Visual C++ does since you are technically on a VM (the CLR), but you should be able to do pretty much anything you need to and you’ll find a large community built around .NET.

.NET is, inherently, OOP in terms of its formal structure, but you can still develop in a classic “structured” format as long as you execute your code in the framework of a class. Try OOP, it isn’t that bad, and you don’t need to get into the high points of OOP like abstract factories to be able to produce something, arrays and lists and strings and ints and structs can get you pretty much anything you need to do. As an OOP language, things like Windows Forms and Buttons are going to be objects themselves, but you don’t need to start doing things like declaring base form classes and deriving custom button type classes if you don’t feel comfortable doing that.

I personally prefer C# since it is more difficult to make a semantic intent error such as doing an implied cast that you didn’t intend or realize was happening, and I’d especially recommend it to someone who doesn’t know the nuances of .NET.

There’s a learning curve, but essentially everyone who embraces object-oriented programming feels it was well worth the trouble.

Find someone who’s competent in C# to give you a 15-minute tour.

Very interesting. That’s a good point about not learning an obsolete language like VB 6. The only reason I considered it is because I’ve heard Office’s Macro script language is based on VB. Isn’t Windows Scripts also based on VB syntax? I use Crystal Reports at work and their newer versions give the option of writing formulas in the old Crystal syntax or VB. I learned Crystal formula syntax years ago, but I’ve thought about using the newer VB option.

I’ll look at C Sharp (C#). If I’m going to get my feet wet in OOP I may as well learn what’s current.
I’m doing this on my own anyhow. My boss at work is only interested in getting his payroll and insurance reports written. It’s mind numbing after all these years. I need a challenge to stay sharp. he he C# that is. :wink:

Honestly, I can’t imagine the nightmare of trying to do anything in any .NET language while trying to avoid OOP, due to the fact that the entire framework is heavily OOP (as already noted).

On the other hand, you could probably do what lots of .NET developers do, and just muddle through button1_Click event handlers without any real understanding of what’s going on…

Check out VB Express and PowerShell

VB Express is just the free version of VB, and the version in yoyodyne’s link is VB.NET Express 2010 (v. 10.0). .NET includes every version since 7.0. The Express versions do most of what the full versions do, IIRC they lack some capabilities from programming in Windows Mobile and maybe some server capabilities.

I am not a programmer, but having used both VB6 and VB8-10, going back to VB6 would cause me to gouge my eyes out. There’s a lot of support for it online, but the lack of some features makes .NET more appealing. If you’re more comfortable with a C environment, C# may work as well.

When you’re just getting familiar with C# you can do a console-based application and avoid all the event handler stuff. You can even just start with notepad and the command line compiler ‘csc’.

class Hello
static void Main(string args) {
System.Console.WriteLine(“hello world”);

I’ve a background similar to yours; my previous efforts to learn OOP through VB were a nightmare. Don’t do it!! It put me off OOP completely for a long time.

I’m currently not programming, but if I were to learn one right now, it would either be C# or .NET. Those seem to be where the action’s at these days. C# is a great place to start, from all I’ve heard.

I’m actually getting ready to dip my toes into PowerShell to write some maintenance scripts, rather than figure out VBS again. I end up having to write scripts every few years, which is more than long enough to forget what I learned last time. So I figure I might as well go with the new solution instead of the nearly obsolete one.

VB6 is great for prototyping GUIs.

Then rewrite the interface engine in the language used on your project.

VB6 is no more object-oriented than FORTRAN-90, both of which have object-oriented structures grafted onto a procedural paradigm. And I, poor soul, have worked in both.

I would never start a project in VB6 for two reasons: It’s a dead language (VB.NET is not the same language as VB6), and it is not sufficiently robust for production software.

Let me add to the chorus of people steering you away from VB6. The first time I used VB6 out of the box I was very impressed with it, but once my company tried to develop with it in an enterprise setting I realized what a painful mess it really was. As others have mentioned VB6 is not Object Oriented, it pretends to be but doesn’t actually implement any of the ideas that make objects such a valuable tool.

I am using C# now and I can tell you that some of your worries are unfounded. The language is not at all low level, it is very easy to learn, and very intuitive to pick up if you already have some programming experience.

When you open up a new Windows Forms Application in C# you automatically create an object, but If you only code inside of that object it will appear, to you, to be a procedurally based program. I think this will perfectly meet your immediate needs.

While it’s true that Object Oriented Programming requires a mental leap, once you make it you’ll be surprised at how sensible it is, and the reason why all enterprise level code is now developed with objects. If you decide to use C# I’d recommend picking up some entry level books on OOP to get the hang of it. I think once you do you’ll find yourself using it more and more in your own programs.

if you are “business programmer” why do you need Win API? Businesses usually write desktop apps in dotnet ( or C#) or Java with all the actual api safely hidden from you by layers of managed libraries.

You don’t have to master OOP to write a C# or app. Neither should you expect all users of these languages to be stellar at it. This is a continuum, and the more you know, the better you will architect your apps and the more productive you will become. But if you prefer apps with the huge “God object” module you can write them in OOP languages just like in procedural ones.

Any recommendations for good intro books on C# and learning OOP?

This book is very helpful both for C# and OOP. It’s written in a fun way and not at all dry.