473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Cast ListDictionary

SK
Hello,

I am trying to convert an object to a ListDictionary,
but I get always the error: Specified cast is not valid.
Here is my code:

Private Property StoredProcedureParams() As ListDictionary
Get
Dim o As Object = ViewState("StoredProcedure")
If o Is Nothing Then
Return Nothing
Else
Return CType(o, ListDictionary)
End If
End Get
Set(ByVal Value As ListDictionary)
ViewState("StoredProcedureParams") = Value
End Set
End Property
Nov 19 '05 #1
2 1635
First of all, you viewstate key names are not the same. Does this matter in
your context?

"SK" <an*******@discussions.microsoft.com> wrote in message
news:0e****************************@phx.gbl...
Hello,

I am trying to convert an object to a ListDictionary,
but I get always the error: Specified cast is not valid.
Here is my code:

Private Property StoredProcedureParams() As ListDictionary
Get
Dim o As Object = ViewState("StoredProcedure")
If o Is Nothing Then
Return Nothing
Else
Return CType(o, ListDictionary)
End If
End Get
Set(ByVal Value As ListDictionary)
ViewState("StoredProcedureParams") = Value
End Set
End Property

Nov 19 '05 #2
SK
Yeah, that was the problem. Thanks

-----Original Message-----
First of all, you viewstate key names are not the same. Does this matter inyour context?

"SK" <an*******@discussions.microsoft.com> wrote in messagenews:0e****************************@phx.gbl...
Hello,

I am trying to convert an object to a ListDictionary,
but I get always the error: Specified cast is not valid.
Here is my code:

Private Property StoredProcedureParams() As ListDictionary Get
Dim o As Object = ViewState ("StoredProcedure") If o Is Nothing Then
Return Nothing
Else
Return CType(o, ListDictionary)
End If
End Get
Set(ByVal Value As ListDictionary)
ViewState("StoredProcedureParams") = Value
End Set
End Property

.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim Douglas | last post by:
{System.Collections.Specialized.ListDictionary.NodeKeyValueCollection} : {System.Collections.Specialized.ListDictionary.NodeKeyValueCollection} Count: 25 ?entry.Contains("MachineName") ...
4
by: Doug | last post by:
I'm trying to create a user control that would have a ListDictionary property. When trying to use the property and set values for this collection, the dialog box that appears has everything...
0
by: Aaron W. West | last post by:
Fun with CAST! (Optimized SQLServerCentral script posts) I found some interesting "tricks" to convert binary to hexadecimal and back, which allow doing 4 or 8 at a time. Test code first: --...
6
by: Allen Jones | last post by:
Hi, I tried to extend ListDictionary in order to create a thread safe version named SynchronizedListDictionary. Despite the docs saying the properties and methods of ListDictionary are...
0
by: Bas Gooijen | last post by:
hey all, my custom control has a property of type ListDictionary, and i want the designer to store the values in the InitializeComponent section. so that the values persist when loading/saving...
2
by: Doug | last post by:
Not that I'd actually do this... but knowing the answer would give me a bit more understanding of the .NET Framework and the base class libraries - specifically how things work in relation to my...
0
by: Gabriel Cirera | last post by:
Hello, Is it possible to fill a DataGrid with a ListDictionary? I tried to find the solution in this groups but I couldn't... Maybe is not possible.. who knows. I suppose it has to be some way...
0
by: Phil Galey | last post by:
I have a ListDictionary, from which I need to get an array of the keys and an array of the values, so I can Join() each to a delimited string. However, the Keys and Values properties are both...
5
by: Frederick Gotham | last post by:
Before I begin, here's a list of assumptions for this particular example: (1) unsigned int has no padding bits, and therefore no invalid bit- patterns or trap representations. (2) All types have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.