TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jay S
NA
230
59.4k
Add items to list
May 14 2013 2:09 PM
Currently I'm creating a list in "Form1" pretty much this:
//
//
this.Shortlist = new System.Collections.Generic.List<Shortlist>();
this.ShortlistIndex = (int)binaryReader.BaseStream.Position;
for (i = 0; i < (int)shortlistnum; i++)
{
Shortlist item2 = new Shortlist(binaryReader);
this.Shortlist.Add(item2);
}
binaryReader.Close();
The Shortlist class is:
public class Shortlist
{
public string Name;
public string Nation;
public string NationalityName;
public int Age;
public Shortlist()
{
}
public Shortlist(System.IO.BinaryReader reader)
{
this.Name = reader.ReadString(128).Replace("\0", string.Empty);
}
}
All works fine..I then call another function (still in Form1) which joins this list with another list to create a 3rd list (and bind it to a listview):
private void Populate(object sender, EventArgs e)
{
var userlist = (from Item1 in Shortlist
join Item2 in People
on Item1.Name equals Item2.FullName
into grouping
from Item2 in grouping.DefaultIfEmpty()
select new
{Item2.FullName
,Item2.Age
,Item2.CountryName
,Item2.Nationality
}).ToList();
this.fastObjectListView3.SetObjects(userlist);
}
Again, happy with this, all is ok..
In "Form2" I have a button and when clicked I want to pass a pre-defined string/item/value/object...whatever you call it and add it into this.Shortlist (In Form1) and then my "Populate" function called to repopulate & bind my 3rd list.
I can't seem to work out how to add across classes..any help..Vulpes :p would be great
Reply
Answers (
6
)
pass value to query
C application update for mysql In C