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

Using IList Remove method with a Custom DataType

a
I'm trying to delete an item from a collection, by clicking on a delete
button in a GridView control.

The item in the collection is stored in the Profile object (serialized as
xml in the ASPNETdb profile table).

The code to insert a new Student is:
Profile.Teachers[tId].Classes[cId].Students.Add(new TCS.Student(id, teacher,
class, name));

I'd like to use just the student name (stored in the GridView where the
Delete button is)
in the Remove method if that is possibl. I have a constructor for the
student that takes just
the student name. The Remove method is expecting "TCS.Student value", but I
don't
undertstand what to feed it to make it work. In the code below, I tried :
Remove(new TCS.Student(name)).

================================================== ===

protected void GridView_Students_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{

int tId = (DropDownList_Teachers.SelectedIndex); // Index of Selected Teacher
int cId = (DropDownList_Classes.SelectedIndex); // Index of Selected Class

string name = (GridView_Students.Rows[e.RowIndex].Cells[2].Text); // Student
Name

Profile.Teachers[tId].Classes[cId].Students.Remove(new TCS.Student(name));//
This line fails
Populate_GridView_Students();

}

Any ideas what I need to do to Remove a student based upon
something other than an index number, like their name?

Thanks,

Paul
Mar 2 '06 #1
0 2171

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

Similar topics

2
by: tsteinke | last post by:
I noticed somthing. The native Array Types implement the IList interface. However they do not contain all the methods in the interfaces they implement. for example... int test=new int;...
5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
0
by: Dave | last post by:
Tried posting in the Winform Forum without much luck, so posting here... After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is...
3
by: Tom McLaughlin | last post by:
I am new to vb.net and I am running into problems understanding DataBinding and its concept. The only examples I find are always talk about Web design, I only want to use this data on my...
1
by: Ldraw | last post by:
I am returning an IList from a WebService Function that contains a custom Class. The class contains ID and Name properties. I can see these in the IList when the data is returned. I tried to use...
7
by: Tom Costanza | last post by:
I have a collection class that inherits from CollectionBase. I want to override the Contains method for the List property. I'm not sure how to do that. Can anyone assist? Thanks in advance,...
6
by: nicolas.rolland | last post by:
Would anyone know the reson why IList<Tdoes not implements IList ?? This results in strange behaviours, like typeof(IList).IsAssignableFrom(typeof(List<string>)) --true...
6
by: Venkatesh Bhupathi | last post by:
Hi All, I am trying to inherit the Generic IList<Tinterface to form the typed collection of objects of type T. Following is my sample code, Public Class Record { public string name;...
1
by: jvcoach23 | last post by:
I have a custom class QBank with a public property called QBankID. I populate the ilist(to QBank). when the iList is populated, is there a way i can filter on the QBankID property for where it =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.