PDA

Click to See Complete Forum and Search --> : Re: A simple operator !


Dec 29th, 1999, 05:20 AM
What is ! operator for? When should I use this? What are the diff. between ! and .?

Thanx.

SK

lol999
Dec 29th, 1999, 05:54 AM
heck if i know, i want to know too!

------------------
webmaster@hackvp.com
http://www.hackvp.com
<quote>Ask not what you can do for your country, but what can your country do for you</quote>

HeSaidJoe
Dec 29th, 1999, 06:03 AM
Could be wrong on this but I think I'm ok on these examples.

!
Example: is used in rleation to recordsets...it is a shortcut which eleminates the need to type in the field name when processing a filed in a record

data1.recordset!help
is the same as
data1.recordset.yourfield.help

?
example...You can use it as a character when specifing what chracters are permitted in a MaskedEdit control

MaskedEdit1.mask = "?#? #?#"
allows you
alpha number alpha number alpha number

ie..postal code..L6Y 7Y5

Wayne

Ps...I really don't think they are listed as Operators

jpark
Dec 29th, 1999, 06:06 AM
and somemore....

It's from MSDN for "!"(for VB)

The type-declaration character for Single is the exclamation point (!).

so, dim i as Single = dim i!

Or

When using Like Operator

? - Any single character.

"BAT123khg" Like "B?T*" ' Returns True.
"BAbT123khg" Like "B?T*" ' Returns False.
"B9T123khg" Like "B?T*" ' Returns False.

[!charlist] - Any single character not in charlist.

"aM5b" Like "a[L-P]#[!c-e]" ' Returns True.
"aM5b" Like "a[L-P]#[!b-e]" ' Returns False.

Joon

Dec 29th, 1999, 06:16 AM
Please look at the following case.

If frmAccountDisplay!txtAccountBalance.Text < 0 Then
frmAccountDisplay!txtAccountBalance.BackColor = 0 frmAccountDisplay!txtAccountBalance.ForeColor = 255
End If

I have noticed that I can also reference a field (object) on a form using "!" instead of ".". Is it true? If so, in what cases can or should I use "!" instead of "." to reference a field or object?

Thanx.

SK

Clunietp
Dec 29th, 1999, 09:29 AM
With databases/recordsets, the ! is a replacement for the .Fields("FieldName").value

SO

This:
myRS!CustID

would equal this:
myRS.Fields("CustID").Value


Tom

Crazy D
Dec 29th, 1999, 02:15 PM
If I put it in the correct words... it's a short way for looking things up in a collection.
Recordset!FieldName = Recordset.Fields("FieldName")
(Fields is a collection)
Form1!Text1 = Form1.Text1

Look it up in MSDN to get the description in nice words ;-) There is something about speed too.

Dec 29th, 1999, 05:53 PM
I beleive it was once used to access controls
the ! for acessing controls/collections and the . for accessing property's/methods/etc

form1!text1.text = "text"

But then they added collections and stuff to everything and the ! thingie became obsolete.

Crazy D
Dec 29th, 1999, 07:16 PM
Yes, but since Text1 is part of the controls collection you can use the !. But, since it's basically a property of the form too, you can use the . ....

markwestcott
Dec 31st, 1999, 08:19 PM
I don't know if this has anything to do with it, but in maths, x! means x * x-1 * x-2 * x-3 etc. so if x was 5, x! would be 5 * 4 * 3 * 2 *1 = 120