Thanks Rob. I thought I had used DirectCast in C# too .. :-/ ... I've been
programming in both C# and VB.NET concurrently which is why I end up writing
code that looks like this.
Dim conn as SqlConnection ;
And yeah VB.NET 2.0 does have DirectCast.
Thanks for your replies gentlemen !
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Rob Windsor [MVP]" <ro*****************@gmail.com> wrote in message
news:OW**************@TK2MSFTNGP14.phx.gbl...
The closest equivalent in C# is to put the type you want to cast to in
parenthesis in front of the reference variable you want to cast. Note that
both will fail with an exception if the cast is invalid.
Dim tb As TextBox
tb = DirectCast(Sender, TextBox)
TextBox tb;
tb = (TextBox)sender;
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"Sahil Malik" <co*****************@nospam.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...I can't find it .. what am I missing?
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik