views:

138

answers:

3

I'm using VB6.

Data-aware classes refers to classes whose DataBindingBehavior or DataSourceBehavior property is set.

I learned this concept from MSDN and am wondering usually when should we use this technique of Data-aware classes? Or just like the Data Environment Designer which is just ignored by most developers?

+1  A: 

Do you have any idea how old VB6 is? It's about ten years old. You should pretty well ignore anything you "learn" from VB6.


Some resources on VB6:

All of this is from the following search: http://social.msdn.microsoft.com/Search/en-US/?Refinement=22&Query=vb6.

John Saunders
r u sure? to ignore ANYTHING?
SlowGrace
Yes. Why are you using VB6 at all? It's _ancient_!
John Saunders
I think what John is trying to communicate here is that VB6 is not a good choice for new development. There are some exceptions IMHO - for example if your organisation already has a lot of VB6 experience and a lot of VB6 code to maintain, and no experience of other desktop programming languages. That sounds unlikely in your case, otherwise you'd be asking your colleagues this question rather than posting on Stack Overflow! So it's worth considering why you've chosen VB6.
MarkJ
http://news.softpedia.com/news/Visual-Basic-6-0-on-Windows-7-but-Not-on-Windows-8-105474.shtml
SlowGrace
Visual Basic 6.0 on Windows 7, but Not on Windows 8. Yes there will be support, but just for Vista's successor
SlowGrace
No. Read more carefully. It is already not supported. The IDE is supported "until April 8, 2008". It is programs that already run on Windows XP that are guaranteed to still work on Windows 7 but not Windows 8. It is already not supported to create such programs.
John Saunders
Please forgive me for my slow understanding, but What do u mean by "It is already not supported to create such programs."? Still I can create VB6 applications today!
SlowGrace
VB6 IDE: Extended support until April 2008, Custom Support after April 2008. I just am not sure of the meaning of "Custom support".
SlowGrace
The IDE is unsupported. Custom support means if you pay them enough, they may support you, but there is no regular support at all. Extended support ended April 2008. It's dead. Seriously, what other ten year-old software is still supported?
John Saunders
A: 

I think that feature has been ignored by most VB6 developers. Certainly I experimented with it once and never used it again. If you Google DataBindingBehavior or DataSourceBehavior there are relatively few hits.

I think what John is trying to communicate in his answer is that VB6 is not a good choice for new development unless you have strong reasons to the contrary - for example if your organisation already has a lot of VB6 experience and a lot of VB6 code to maintain, and no experience of other desktop programming languages. That sounds unlikely in your case, otherwise you'd be asking your colleagues the question rather than posting on Stack Overflow!

MarkJ
Thanks for your patience. Yes, I'm alone at home and am quite new here. If my question is not suitable for StackFlow, please tell me.
SlowGrace
Maybe both of you have VB.NET in mind, I guess. But they say .net needs a lot of resources and not so mature as VB6. You could say VB6 is ancient but it is classic also.
SlowGrace
I'm trying to write an ActiveX control for me myself. I think in this case VB6 is more convenient for me than VB.NET, as I am totally foreign to .NET.
SlowGrace
Your question is suitable. I was worried about your reasons for doing this in VB6. You might have done a Google search for ActiveX Controls and found VB6 examples, and thought that was the modern way to do things. It's not - it's the 1998 way to do things.
John Saunders
I don't know who you're talking to who's saying .NET is not as mature. Maybe someone is playing a joke on you. VB6 is not just "mature" - it has grown old and died. .NET has been here for seven years. That's very mature as software goes.
John Saunders
You are so understanding! So would you please tell me what's the modern way?
SlowGrace
Oh, the above is a reply to upper 2. (I forgot to refresh the page before reply).
SlowGrace
The modern way would be VB.NET or C#. If you like what you saw with VB6, download a copy of Visual Basic 2008 Express from http://www.microsoft.com/express/. It's free, but it's right up to the minute, and I think you'll love it! You can even get SQL Server 2008 Express free on the same site.
John Saunders
To John, your words make me desperate:) I've just read through MSDN'S VB6 documnent (dating 2001 october). I think in my case I'd be better stick to VB6, at least till finishing this small piece of software.
SlowGrace
Sorry, I forgot to refresh again.
SlowGrace
One of my friend said that in .NET COM+ and COM are not implemented good enough as VB6.
SlowGrace
Your friend should pull his head out of ... the sand. First, neither COM nor COM+ is as important as it was ten years ago. Second, .NET handles them both as well as, if not better than, VB6. I think you need new friends.
John Saunders
+2  A: 

The ability to create data-aware classes is just another aspect of Visual Basic's extensibility model. Along with the ability to create standard Classes and UserControls, you can create them as data-aware classes that can plug into VB's data binding mechanism.

You can wrap something like an ADO Recordset or ADO Data Control to create a more application-specific component, or you can create your own from scratch to provide data binding for some sort of out of the ordinary data. You can even create basic custom OLE DB Providers for unusual requirements by writing VB6 data aware classes in conjunction with the OLE DB Simple Provider (OSP) Toolkit.

Most of these things are rarely used today, because VB6 education is sorely lacking. A lot of programmers who learned by example shy away from data binding because they've found it frustrating. Most of this is a lack of understanding though. Instead we fall back on writing a lot of QBasic-like procedural code that sacrifices the power of VB6 event based programming.

You'll see the same thing in a lot of VB.Net and C# code loose in the wild. People seem unaware that event driven programming is actually much more important than the degree of "OOPiness" yet that's where the focus seems to be.

Programmers who understand the importance of this tend to have a lot fewer DoEvents loops in their VB6 programs and almost no gratuitous multithreading in their .Net programs.

I am as guilty as anyone of avoiding the Data Environment Designer and bound controls. I plan to become more aware of their use and capabilities though as well as making more use of VB6's Data Report Designer. These are powerful tools for writing data-centric programs, something I'm doing a lot more of lately.


There is no argument that Microsoft has dropped all support for VB6 development. But this doesn't say anything about the demand for it, which continues to be strong. If people have little to contribute to answering a question about VB6 they might spend their effort better elsewhere instead of shouting it down here. It is very sad that we never got a follow-on product - a newer VB supporting 64-bit development would be really nice. It just isn't in the cards.

Bob Riemersma
Bob, did you consider trying to do similar things with more modern, supported tools? Also, FYI, if the OP were someone like yourself, already elbow-deep in VB6 development, I would not have attempted to dissuade him. It seems like someone may be misleading him into _starting_ with VB6 when he has a choice of tools. Certainly it doesn't make sense to start with an unsupported tool.
John Saunders
John, thank you for your attention. I'm just using VB6 to write several small applications for me myself. I've used VB6 a decade ago, so I think it will be time-saving for me to refresh the knowledge of it than to master the completely new .NET. That's why I choose VB6 now. I'm not professional, just writing for me myself:)
SlowGrace
As to the choice of develop tools, a friend told me "it depends on requirement". If a tool meets the requirement, it is ok and no need to after the newest one. Do you agree?
SlowGrace
And I agree with you that for a serious new professional starters, to choose the new one is a wiser action.
SlowGrace
To Bob, thank you for your reply. Some friends told me that data-binding controls in VB6 was not so good. Problems will occur when dealing with multi-user applications, also the data verification mechanism sometimes has bug.
SlowGrace
As to data-ware classes, I like the classes arrangement in the architecture. You see, there are Data Sources, Data Consumers, and Data Binders, they each has a clear role, and cooperates clearly. The arrangement makes the logic quite clear.
SlowGrace
And I am a little surprised that you make event-driven mechanism an opposite to OOP, multi-threading. It's somehow a new idea to me:)
SlowGrace
And a little question to John, what is an "OP"?
SlowGrace
Well I would have to agree that it makes very little sense for a new developer to be trying to pick up VB6 programming skills this late in the game. Not always, after all any job is a job, but unless you've been hired to do just that VB6 programming probably isn't where you should be.
Bob Riemersma
SlowGrace - If somebody can demonstrate a bug I'd be glad to acknowledge it. But I don't think "I can't get it to work" = bug without evidence no matter how frustrating it gets for me.
Bob Riemersma
If it's too tiresome to get something work, maybe to most people it nearly equals to not work.
SlowGrace
And would you please give me some suggestions to this question?http://stackoverflow.com/questions/1205809/how-to-reuse-my-application
SlowGrace