Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Illegal =

1 view
Skip to first unread message

Matt Rutherford

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
Is VB not capable of handing multiple assignments on one line of code?...
for example

Dim dteDate as Date
..

.AddNew
!UpdateDateTime = dteDate = Now
..
..

!UpdateDateTime is always returning 12/30/1899 0:00:00

I know this kinda thing works in C++, and I sorta figured it would work in
VB, however, to my surprise, it seems that it doesn't work....

Matt Rutherford


gHaD

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to


!UpdateDateTime = (dteDate = Now)

translates to:

!UpdateDateTime = False

since dteDate probably doesn't equal Now. The right side is evaluated
and then assigned to the field....

And False = 0, which is the value of the date 12/30/1899 0:00:00.

C++ might have a better chance of working since there's a difference
between '=' and '=='.

--
HTH
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| gHaD (Aaron Robinson) |The Never-Ending Commute|
|Web & Database Developer| Will work for Dew®! |
| Chicago, IL | It pays better... |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Jeff Johnson

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to

Matt Rutherford <matt.l.r...@ccmail.census.gov> wrote in message
news:uo5Z#ELF$GA.230@cppssbbsa05...

> Is VB not capable of handing multiple assignments on one line of code?...

Simple answer: no it is not.

Longer answer: VB will never be capable of this because it does not
distinguish between assignment and comparison the way C(++) does with = and
==.

cheui

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
Jeff Johnson wrote in message ...
><snip>

>Longer answer: VB will never be capable of this because it does not
>distinguish between assignment and comparison the way C(++) does with = and
>==.


That is of course unless that the people at Microsoft decide to change the
language to make that distinction. What do you think the possibility of that
happening is?

I come from an APL (array-processing) background and so i seriously miss
being able to make multiple assignments and i am finding it a serious
drawback not to have that functionality.

cheui
It's one of those things that you dont realise what you've got till its gone
:(


کک''°؛؛°''ک¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨کک''°؛؛°''کک¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ک''°؛؛°''کک
"If A equals success, then the formula is:
A = X+Y+Z.
X is work. Y is play.
Z is keep your mouth shut."

-Albert Einstein


RJolt

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to

Jeff Johnson <pawprint@your_clothes.geocities.com> wrote in message
news:ebVP3wLF$GA....@cppssbbsa02.microsoft.com...

>
> Matt Rutherford <matt.l.r...@ccmail.census.gov> wrote in message
> news:uo5Z#ELF$GA.230@cppssbbsa05...
>
> > Is VB not capable of handing multiple assignments on one line of
code?...
>
> Simple answer: no it is not.
>
> Longer answer: VB will never be capable of this because it does not
> distinguish between assignment and comparison the way C(++) does with =
and
> ==.

Well, it's _possible_ anyway:

a = Eq(b, Eq(c, Eq(d, e)))

Function Eq(Var1, Var2)
Var1 = Var2
Eq = Var2
End Function

Klaus H. Probst

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
Actually, what you're doing there is assigning a Boolean result to your
database field. VB will evaluate dteDate = Now as an equality comparison,
and then try to assign the result of the evaluation to the field. Like Jeff
said, it's because VB has no separate assignment and equality operators,
unless you count Let <ugh>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please post/reply to the
newsgroup(s)

Klaus H. Probst
http://members.xoom.com/kprobst/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Matt Rutherford <matt.l.r...@ccmail.census.gov> wrote in message
news:uo5Z#ELF$GA.230@cppssbbsa05...
> Is VB not capable of handing multiple assignments on one line of code?...

> for example
>
> Dim dteDate as Date
> ..
>
> .AddNew
> !UpdateDateTime = dteDate = Now
> ..
> ..
>
> !UpdateDateTime is always returning 12/30/1899 0:00:00
>
> I know this kinda thing works in C++, and I sorta figured it would work in
> VB, however, to my surprise, it seems that it doesn't work....
>

> Matt Rutherford
>
>
>
>
>

Jim Deutch

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
cheui wrote in message <7tvi6m$a8b$1...@ctb-nnrp2.saix.net>...

>Jeff Johnson wrote in message ...
>><snip>
>>Longer answer: VB will never be capable of this because it does not
>>distinguish between assignment and comparison the way C(++) does with =
and
>>==.
>
>
>That is of course unless that the people at Microsoft decide to change the
>language to make that distinction. What do you think the possibility of
that
>happening is?


The probability of MS _deliberately_ making a language change that breaks
lots of existing code is almost zero (of course, they do it by accident now
and then). So they'll never _enforce_ the difference between = and ==.

They could conceivably _add_ the new operator == to VB, but that won't solve
the problem that started this thread...

Jim Deutch
MS Dev MVP

Russ McClelland

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
Wouldn't it be sweet if VB allowed operator overloading. One could create
an := (ala Smalltalk) to do this same thing:

a := b := c


RJolt <rj...@iname.com> wrote in message news:u8qorkMF$GA.226@cppssbbsa05...


>
> Jeff Johnson <pawprint@your_clothes.geocities.com> wrote in message
> news:ebVP3wLF$GA....@cppssbbsa02.microsoft.com...
> >

> > Matt Rutherford <matt.l.r...@ccmail.census.gov> wrote in message
> > news:uo5Z#ELF$GA.230@cppssbbsa05...
> >
> > > Is VB not capable of handing multiple assignments on one line of
> code?...
> >

> > Simple answer: no it is not.
> >

> > Longer answer: VB will never be capable of this because it does not
> > distinguish between assignment and comparison the way C(++) does with =
> and
> > ==.
>

meb

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
Saw an article once by a Pascal developer giving his reasons why Pascal
is better then C++. The most interesting one went somthing like:

In C++, you can say things like x == *(M + **N) || !(**Y / *Z);
In Pascal, you can't.

Jeff Johnson

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to

Klaus H. Probst <kpr...@altavista.net> wrote in message
news:eIFZQwMF$GA.223@cppssbbsa03...

> Like Jeff
> said, it's because VB has no separate assignment and equality operators,
> unless you count Let <ugh>

A POX ON THEE! Thou hast uttered the forbidden word!

Can you believe there are still people who use this? I mean, talk about
deadwood....

Klaus H. Probst

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to
> > Like Jeff
> > said, it's because VB has no separate assignment and equality operators,
> > unless you count Let <ugh>
>
> A POX ON THEE! Thou hast uttered the forbidden word!
>
> Can you believe there are still people who use this? I mean, talk about
> deadwood....

Don't be so surprised... I know of some shops that actually use and *enforce*
Rem as a standard.


~~~~~~~~~~~~~~~~~~~~~~~~~~~

@epsomdotcomdotau david

unread,
Oct 13, 1999, 3:00:00 AM10/13/99
to
When I had a BASIC that allowed multiple assignments on one line of code
the syntax was different. It did not depend on distinguishing between
= and .EQ. the way FORTRAN does. But it was an ordinary part of
many BASIC's

Jeff Johnson wrote in message ...
>

0 new messages