From: johnb on
Hi Guys

Thank you for your useful comments. Yeah I'm learning to fish with this one
but good have more than one rod in the bag.

Thanks once more

johnb

"Cor Ligthert[MVP]" wrote:

> Peter,
>
> I've seen that the getType is currently more popular, but why not the way we
> here in this newsgroup has done it forever.
>
> If Typeof object Is Classname?
>
> http://www.vb-tips.com/ControlBorder.aspx
>
> Is this a kind of verCSharping (I don't know if you knows a tiny little bit
> Dutch, then you understand it)
>
> It means something as: using C# ways, where there is a very good VB
> alternative.
>
> :-)
>
> Cor
>
> "PvdG42" <pvdg42(a)toadstool.edu> wrote in message
> news:OIbe1rM2KHA.1016(a)TK2MSFTNGP02.phx.gbl...
> >
> > "johnb" <johnb(a)discussions.microsoft.com> wrote in message
> > news:A2474CF4-69FB-4320-B080-CD45BDE16757(a)microsoft.com...
> >> Hi All
> >> What is the code to loop thru all textbox controls on a form?
> >>
> >> TIA
> >> johnb
> >
> > The Form class (which derives from Control) has a Controls property:
> >
> > http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls.aspx
> >
> > which is a collection of type Control.
> >
> > The Control class has a GetType() method to allow you to determine if the
> > current control is a TextBox.
> >
> > http://msdn.microsoft.com/en-us/library/system.object.gettype(v=VS.90).aspx
> >
> >
> >
> .
>
From: Armin Zingler on
Am 11.04.2010 03:39, schrieb PvdG42:
>>
> I'm not trying to start anything,

But you did. :-)

> just trying to offer the OP a way the
> "learn to fish".
> Your way is certainly just as good,

I'm not a native English speaker, so what does "*just* as good" mean
in _this_ case? :) "ok, use it if you want", or "as good as", or
"better than"?

I say TypeOf is to be preferred because it's "just quicker".
About 3.5x quicker (in my personal, I predict that one will say
disputable, tests). (yes, and I do know that both methods are not the same
because TypeOf includes inherited classes). And, BTW, TypeOf is 1:1
translated to the "isinst" IL keyword.

> and certainly more VB-traditional.

Curly braces in C are also traditional. AND THAT DAMNED
CASE SENSITIVITY TOOOOO! Ummm... sorry, Sunday morning... ;)


--
Armin
From: PvdG42 on

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:#Z7Zs9V2KHA.1708(a)TK2MSFTNGP05.phx.gbl...
> Am 11.04.2010 03:39, schrieb PvdG42:
>>>
>> I'm not trying to start anything,
>
> But you did. :-)
>
>> just trying to offer the OP a way the
>> "learn to fish".
>> Your way is certainly just as good,
>
> I'm not a native English speaker, so what does "*just* as good" mean
> in _this_ case? :) "ok, use it if you want", or "as good as", or
> "better than"?
>
> I say TypeOf is to be preferred because it's "just quicker".
> About 3.5x quicker (in my personal, I predict that one will say
> disputable, tests). (yes, and I do know that both methods are not the same
> because TypeOf includes inherited classes). And, BTW, TypeOf is 1:1
> translated to the "isinst" IL keyword.
>
>> and certainly more VB-traditional.
>
> Curly braces in C are also traditional. AND THAT DAMNED
> CASE SENSITIVITY TOOOOO! Ummm... sorry, Sunday morning... ;)
>
>
> --
> Armin

Then, I should have said "you way is better". I stand corrected.
Thanks, Armin. I was not aware of the significant performance difference.



From: PvdG42 on

"johnb" <johnb(a)discussions.microsoft.com> wrote in message
news:B80896B0-AC66-4C80-B685-3D065334E578(a)microsoft.com...
> Hi Guys
>
> Thank you for your useful comments. Yeah I'm learning to fish with this
> one
> but good have more than one rod in the bag.
>
> Thanks once more
>
> johnb
>
Pay close attention to Armin's latest post. Note the significant improvement
difference using TypeOf.