Could somebody tell me whats wrong in below code. I get an error message while i try to add the below code in my project:
An unhandled exception of type 'System.ArgumentException' occurred in infragistics.win.v3.1.dll. Additional information: Can't add a ValueListItem to a value list item collection
Dim ValueListItem1 As Infragistics.Win.ValueListItem = New Infragistics.Win.ValueListItem
Dim ValueListItem2 As Infragistics.Win.ValueListItem = New Infragistics.Win.ValueListItem
ValueListItem1.DataValue = False
ValueListItem1.DisplayText = "Date/Facility"
ValueListItem2.DataValue = False
ValueListItem2.DisplayText = "Facility/Date"Me.optSort.Items.Add(ValueListItem1) - ERROR Here Cant add a valueListItem to value list item collectionMe.optSort.Items.Add(ValueListItem2)
Is there any more information in the error message? It looks like you are paraphrasing the error instead of posting the exact text.
What is optSort in this code?
Mike,
Friend WithEvents optSort As Infragistics.Win.UltraWinEditors.UltraOptionSet
Error:
An unhandled exception of type 'System.ArgumentException' occurred in infragistics.win.v3.1.dll
Additional information: Can't add a ValueListItem to a value list item collection
Unhandled Exception: System.ArgumentException: Can't add a ValueListItem to a value list item collection
at Infragistics.Win.ValueListItemsCollection.System.Collections.IList.Add(Object value)
at Infragistics.Win.ValueListItemsCollection.Add(ValueListItem item)
Hi,
Well, ValueListItem clearly is the correct type of item to add to that collection. So either this is a huge bug in the version of the controls you are using, or else Visual Studio thinks that the ValueListItem class that you created and the ValueListItem class that the OptionSet is expecting are two different thing.
Just to be sure, I tried this out using the latest service release of NetAdvantage 12.2 and this same code works fine for.
The version you have is more than 10 years old, so it's certainly possible that this is a bug in the old control. I don't remember any bugs like that, but then again it was 10 years ago, so it's not surprising.
If this is a case of Visual Studio and the DotNet framework mismatching the types, then it could be that your application is loading two different versions of the Infragistics.Win assembly. This can happen if you have multiple projects in the solution and they are referencing different versions of the assembly, or if you set CopyLocal to true on that assembly. It can also happen if a different version of the assembly is referenced in our licenses file.
I tried to find the latest version NetAdvantage 12.2 but couldnt find it. Would you mind sharing the link to download it.
Thanks
Shiva
Hello Shiv,
Thank you for your response.
Since your project was originally using NetAdvantage 2003 Volume 1, it's probably still being built against version 1 of the CLR. You need to change the project properties so the project is built against version 2.0 or newer of the CLR. In order to do this, you will need to use at least Visual Studio 2008 since earlier versions don't provide the ability to change the version of the CLR you are targeting. Once the project is targeting CLR2 or greater those errors should disappear.
Dave, I am sorry, still am getting err msg. I did add the dlls with ur utility to upgrade the references. But still it throws the err msg. Screenshot attched
Instead of trying to add the DLLs manually, you should use our Version Utility to upgrade the references that currently exist in your project.
You can find the Version Utility on the Start Menu inside the Infragistics folder.
Dave,
I tried adding the referrences but its throwing an error msg. Screenshot AttCHED
I'm a bit confused. You say you have NetAdvantage 2008 Volume 2 installed, but your list of references shows NetAdvantage 2003 Volume 1. Please verify which version you are using.