473,666 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generics collection<T> bindinglist<T>

Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.

Or maybe someone has an easier way

Many Thanks

Mike
May 4 '06 #1
5 7588
"Mike Surcouf" <mike@$surcouf. co(.uk> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.


I think you can use the Collection<T> constructor that takes an IList<T>
parameter, i.e.
gridRows = new BindingList<Sal esInvoiceListCo mpassSelectRow> (rows);

Chris Jobson
May 4 '06 #2
"Mike Surcouf" <mike@$surcouf. co(.uk> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.


I think you can use the Collection<T> constructor that takes an IList<T>
parameter, i.e.
gridRows = new BindingList<Sal esInvoiceListCo mpassSelectRow> (rows);

Chris Jobson
May 4 '06 #3
"Mike Surcouf" <mike@$surcouf. co(.uk> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.


I think you can use the Collection<T> constructor that takes an IList<T>
parameter, i.e.
gridRows = new BindingList<Sal esInvoiceListCo mpassSelectRow> (rows);

Chris Jobson
May 4 '06 #4
"Mike Surcouf" <mike@$surcouf. co(.uk> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.


I think you can use the Collection<T> constructor that takes an IList<T>
parameter, i.e.
gridRows = new BindingList<Sal esInvoiceListCo mpassSelectRow> (rows);

Chris Jobson
May 4 '06 #5
Hi Chris

That worked perfectly thanks a lot.

Mike

"Chris Jobson" <ch**********@b tinternet.com> wrote in message
news:ub******** *****@TK2MSFTNG P04.phx.gbl...
"Mike Surcouf" <mike@$surcouf. co(.uk> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi All

I have a stored procedure wrapper that returns Collection<T>.
The wrapper is generated by codesmith so I don't really want to start
altering it.
I need to use this collection in a datagridview.
I would like the ability to add to this collection or delete from this
collection using the grid.
I know I will need to use Bindinglist<T> for this but I don't seem to be
able to cast from
collection<T> to bindinglist<T>

Sample Code

gridRows = (BindingList<Sa lesInvoiceListC ompassSelectRow >)rows;

Error I get is

Unable to cast object of type
'System.Collect ions.ObjectMode l.Collection`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'
to type
'System.Compone ntModel.Binding List`1[CompassEdi.Sale sInvoiceListCom passSelectRow]'.

Maybe I have to iterate through Collection<T> and add to BindingList<T>.


I think you can use the Collection<T> constructor that takes an IList<T>
parameter, i.e.
gridRows = new BindingList<Sal esInvoiceListCo mpassSelectRow> (rows);

Chris Jobson

May 5 '06 #6

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

Similar topics

2
10555
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
15928
by: ESPNSTI | last post by:
Hi, I'm trying to use a generics dictionary with a key class that implements and needs IComparable<>. However when I attempt to use the dictionary, it doesn't appear to use the IComparable<> to find the key. In the example below, accessing the dictionary by using the exact key object that was used to add to the dictionary works. (see code comment 1). However, if I attempt to access the dictionary by using a key object that
6
12995
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this is not an ASP.NET related question, but I know this group is knowledgeable and quick with responses. Thanks
1
4708
by: Michael Primeaux | last post by:
Why does the generic SortedList and generic SortedDictionary not define any virtual members? Thanks, Michael
4
5365
by: Michel Walsh | last post by:
Hi, A datagrid has its DataSource set to a BindingList<CustomClass>. While the ListChanged event fires AFTER a deletion, I am looking for a simple way to be notified BEFORE the item would be effectively deleted (for performing extra check and cleanup). Is there a simple trick I miss, because I don't know how to do that, except to maintain TWO lists, and compare them in the ListChanged event (to detect which item is now missing). ...
7
57536
by: Andrew Robinson | last post by:
I have a method that needs to return either a Dictionary<k,vor a List<v> depending on input parameters and options to the method. 1. Is there any way to convert from a dictionary to a list without itterating through the entire collection and building up a list? 2. is there a common base class, collection or interface that can contain either/both of these collection types and then how do you convert or cast from the base to either a...
5
3837
by: David Longnecker | last post by:
I'm working to create a base framework for our organization for web and client-side applications. The framework interfaces with several of our systems and provides the business and data layer connectivity for basic operations and such. I've ran into a snag that I just can't think myself out of. Here's an example: I have an object for a Student called StudentRecord. It has properties such as name, grade, identification number, etc.
44
39155
by: Zytan | last post by:
The docs for List say "The List class is the generic equivalent of the ArrayList class." Since List<is strongly typed, and ArrayList has no type (is that called weakly typed?), I would assume List<is far better. So, why do people use ArrayList so often? Am I missing somehing? What's the difference between them? Zytan
2
6796
by: Oleg Subachev | last post by:
What is the difference between Collection<Tand List<T? Both of them implement the same set of interfaces. Oleg Subachev
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.