Fog Creek Software
Discussion Board




MS VB6 designed by Totalitarians

MS VB6 designed by Totalitarians

It must be true that VB6 was designed by Totalitarians.

Consider this: you have a form with a data control on it. You set the source property to your cool Access database. You add textboxes and DBComboboxes and connect all your controls to your data control. It all works wonderfully. But then you decide that, since one of your Access fields has a currency data type, you want it to be displayed as a currency type. You try to set that control’s Data Format property to currency, but you get a message! “The Data Format property is not supported by this DataSource.” Why is that anyway? Why doesn’t the DataSource go, “Oh, look the underlying data is a Currency type, let’s display it as currency!” This is one of the frustrating and incomprehensible aspects of MS VB6 objects. They work right up until the last detail and then you discover you’ll have to go through all the trauma of changing to some other DataSource scheme! Why can’t they play nice?

Yuck!

WNC
Monday, January 20, 2003

Not trying to start a fight, just wondering if anyone understands this strange behavior.

WNC
Monday, January 20, 2003

WNC,

I would suggest asking this question at http://peach.ease.lsoft.com/scripts/wa.exe?A0=visbas-l - it would seem to be a more appropriate forum that this one.

Another list to try might be http://peach.ease.lsoft.com/scripts/wa.exe?A0=visbas-beginners - particularly since not many members of the first list use the Data control (see http://www.vb-faq.com/Articles/Chang/NoBoundControls.asp for some discussion of why).


Seeya

Matthew Wills
Monday, January 20, 2003

Thanks. Very nice of you to reply with links to help for this problem. I will consider avoiding posting such a comment to this site in the future.

Reading the last ten threads, it doesn't seem so out of place. But I'm not sure I wanted help- I know how to get what I want another way- as I wanted to understand. Since Joel helped implement VBA in Excel and since there are several similar questions in the list,  I thought I'd mention it.

Thanks again

WNC
Monday, January 20, 2003

The solution, of course, is to spell currency correctly.

No. The solution is to put a on change even in the text box that says:

txtDepositAmount.Text = Format(txtDepositAmount.Text, "currency")

But WHY doesn't it format it correctly to begin with? That is the question. Not, How do I do it!

If the underlying data is currancy, why can't the brilliant VB6 controls display it as currancy?

Now, who is going to answer my question?

WNC
Monday, January 20, 2003

I meant to type On-Change EVENT... swine keyboard!

WNC
Monday, January 20, 2003

>>But WHY doesn't it format it correctly to begin with? That >>is the question. Not, How do I do it!

Because if it did, then it would only work for Access and not SQL Server, Oracle, ODBC Datasources, etc.

If it did, the data-binding would be less flexible.

Wayne
Tuesday, January 21, 2003

Good God, WNC, I've never heard so much whining. VB6 isn't telepathic, and neither is any other environment. If you're a programmer, why don't you just, oh, I don't know, write a line of code to handle it? If I recall correctly, currency is just a display format for convenience within Access, not an actual storage format. I could be wrong; it's been 6 years since I've used Access or written code that uses it.

Troy King
Wednesday, January 22, 2003

Microsoft Jet is the database engine that is used to do the actual database work in MS Access. Jet has a Currency data type (8 bytes) that stores over nine-hundred-trillion dollars with up to four decimal places.

WNC
Wednesday, January 22, 2003

Of course, after messing with this for a little while, I discovered that this:

txtDepositAmount.Text = Format(txtDepositAmount.Text, "currency")

doesn't work. You have to do something like this:

txtWithdrawalAmount.Format =  _ "$#,##0.00;($#,##0.00)"

in the on load even for the form and you have to use a MaskEd box.

I post this for those who might find this information looking for a solution of thier own to this problem.

I still don't have any idea why MS didn't make thier controls allow you to display data however you want. Yes, this does mean I'm ignorant, at least about this.

But either everyone else is ignorant or they're too lazy to display thier brilliance by explaining some of the thinking that's going on here.

I would love to learn how it is that I'm not thinking like a programmer on this kind of issue.

WNC
Saturday, February 01, 2003

*  Recent Topics

*  Fog Creek Home