473,225 Members | 1,316 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,225 software developers and data experts.

global generic list

Hi,

I have created a list<t> for my form that displays data in a listview. I
wixh to edit the row with the help of another form and then update the
list<t>. How do I declare a global list that I can use on various forms.

Thanks
Dec 27 '05 #1
6 6407
Vivek,

You don't necessarily have to make the variable global in scope. You
could pass the list from one form to another through a property or method or
public field. However, if you really want, you can just declare the list as
static and public, and then any type will have access to that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vivek" <vi****@xtra.co.nz> wrote in message
news:OY*************@TK2MSFTNGP09.phx.gbl...
Hi,

I have created a list<t> for my form that displays data in a listview. I
wixh to edit the row with the help of another form and then update the
list<t>. How do I declare a global list that I can use on various forms.

Thanks

Dec 27 '05 #2
Thanks. How can I update the LIST once I have updated the values? My target
is to update the database and the list at the same time and then reload my
listview control from LIST.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:e2**************@TK2MSFTNGP14.phx.gbl...
Vivek,

You don't necessarily have to make the variable global in scope. You
could pass the list from one form to another through a property or method
or public field. However, if you really want, you can just declare the
list as static and public, and then any type will have access to that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vivek" <vi****@xtra.co.nz> wrote in message
news:OY*************@TK2MSFTNGP09.phx.gbl...
Hi,

I have created a list<t> for my form that displays data in a listview. I
wixh to edit the row with the help of another form and then update the
list<t>. How do I declare a global list that I can use on various forms.

Thanks


Dec 27 '05 #3
"Vivek" <vi****@xtra.co.nz> a écrit dans le message de news:
ep**************@TK2MSFTNGP12.phx.gbl...

| Thanks. How can I update the LIST once I have updated the values? My
target
| is to update the database and the list at the same time and then reload my
| listview control from LIST.

If you want to allow full interaction with a list from controls like
DataGridView, etc, then you should create your own generic list class that
implements a couple of interfaces :

GenericList<T> : IList<T>, IBindingList, ICancelAddNew
{
private IList<T> items = new List<T>;

...
}

In implementing this class you can then talk to the database from inside
this list class, intercepting the calls that would normally go straight to a
List<T> and adding your own code to keep the database in sync.

Because of the interfaces implemented, data-aware list controls should
update themselves automatically.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Dec 27 '05 #4
Nicholas, Joanna...

Sometimes I think you guys are so helpful that I feel cynic and bitter when
I implement ICompare and foreach you.

Nicholas - Stop spending time on these kind of clueless posts and help where
the action is...You know too much about everything and should focus on the
hard problems. ... which you do great!

Joanna - Rewrite everything you ever written for DM, and your book, to C#
2.0; then ping MSDN Magazine and get yourself a column.. I sure would read
it...

Cheers
- Michael S

Dec 29 '05 #5
"Michael S" <no@mail.com> a écrit dans le message de news:
%2***************@TK2MSFTNGP10.phx.gbl...

| Joanna - Rewrite everything you ever written for DM, and your book, to C#
| 2.0; then ping MSDN Magazine and get yourself a column.. I sure would read
| it...

What is the best way to get in touch with MSDN Magazine ?

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Dec 29 '05 #6
"Joanna Carter [TeamB]" <jo****@not.for.spam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Michael S" <no@mail.com> a écrit dans le message de news:
%2***************@TK2MSFTNGP10.phx.gbl...

| Joanna - Rewrite everything you ever written for DM, and your book, to
C#
| 2.0; then ping MSDN Magazine and get yourself a column.. I sure would
read
| it...

What is the best way to get in touch with MSDN Magazine ?

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


Well, you have several options.

If you want to go hightech you could always use a phone. Or email. If that
is way too complex for you, there is this ROM device called a pencil. It
typically sports fethers and you do it with ink. And there is this device
made out of carbon and parts of a tree, that is actually a kinda RAM. It has
this rubber thingy on that back that makes for rewrites....

As for the editor of MSDN... I have no idea. But I think he (or she) would
be happy if he (or she) got a message saying - I'm freek'n Joanna Carter,
now let me type and then you send me alot of money!

Good luck
- Michael S
Dec 30 '05 #7

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

Similar topics

3
by: Abhi | last post by:
In the following hypothetical example I want to build a generic list of unique string items. How should I implement the pred function so that it returns true/false if target string exists in the...
5
by: majm | last post by:
I'm trying to implement strongly typed lists in the 2.0 framework. I'm using VS2005 beta 2. So far, System.Collections.Generic.List appears to be the ideal solution. However, the...
2
by: Nicolas Fleury | last post by:
Hi, I have a field named "BaseClasses" in C++ as in the following simplified code: using Collections::Generic::List; namespace A2M { namespace LipIntrospection { public ref class...
0
by: crazyone | last post by:
I've got a gaming framework i'm building and i want to save myself the trouble of reading and writting the complete game data to a custom file and load/save it to an XML file but i'm getting...
4
by: rsa_net_newbie | last post by:
Hi there, I have a Managed C++ object (in a DLL) which has a method that is defined like ... Generic::List<String^>^ buildList(String^ inParm) Now, when I compile it, I get "warning C4172:...
3
by: Peter Olcott | last post by:
How does not specify the sort criteria for Generic.List ?? The way that this is done in C++ STL is to implement operator<(), how is this done in C# and DotNet for Generic.List ???
8
by: Nip | last post by:
Hi I want to access the Generic List of the following c++-class inside a vb.net app. Is this possible/how can I do that? Atm, I get the following error in the vb.net app: "Field 'GeoElems' is of...
1
by: shapper | last post by:
Hello, I have an Enum and a Generic.List(Of Enum) 1 Public Enum Mode 2 Count 3 Day 4 Month 5 End Enum
3
by: Arcadefreaque | last post by:
I'm realizing how little I know about C++ today as I try to convert some functionality from VB.Net to C++. I have a procedure that I need to pass a List of objects to, and cannot see how to do...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.