By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

Casting : example in VB.NET

P: n/a
Vic
Hi,

in VB.NET there is the following code:

Friend htProvidedProperties As New Hashtable()

Private Class TextboxValidatorProvidedProperties
Public DataType As DataTypeConstants
Public RegularExpression As String = String.Empty
End Class

'casting 1
Dim ProvidedProperties As
TextboxValidatorProvidedProperties = DirectCast
(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties)

'Casting2
Return DirectCast(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties).DataType
How can I do the casting (1 and 2) in C#?
I tried Convert.ChangeType(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties);
But it don't work (gives errors).

Thanks in advance
Vic

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Vic,
How can I do the casting (1 and 2) in C#?


((TextboxValidatorProvidedProperties)ctrl)

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.