Click here to Skip to main content
15,904,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if you look picture http://imageshack.us/f/190/sh*t34.png/[^]

I have not created any ID in listviewitem

Here are my classes

http://imageshack.us/f/692/sh*t33.png/[^]

In Customer class i have

public int ID
{
    get
    {
        return id;
    }
    set
    {
        id = value;
    }
}


which i then wants to determine by a CustomerManger object


anyway what can i do to make an ID where i wants the ID to start with 100 and can also understand if item is deleted.

listviewitem = new ListViewItem(); //here should be the ID
listviewitem.SubItems.Add(contact.FirstName);
listviewitem.SubItems.Add(contact.LastName);
listviewitem.SubItems.Add(phone.Home);
listviewitem.SubItems.Add(phone.Mobile);
listviewitem.SubItems.Add(address.Country);
listviewitem.SubItems.Add(address.ZipCode);
listviewitem.SubItems.Add(address.City);
listviewitem.SubItems.Add(address.Street);
listviewitem.SubItems.Add(email.Personal);

this.listView1.Items.Add(listviewitem);
Posted
Updated 7-Mar-12 3:47am
v3
Comments
V. 7-Mar-12 9:52am    
What do you want exactly? A concatenated primary key like 100_T_uid or 100_F_uid ? (T/F = deleted true/false) I'm not following what you want or where you want to go.
Shahin Khorshidnia 7-Mar-12 11:19am    
Very confused!
What is CustomerManager doing?
Why has not the Customer class used in the code?
Why don;t you use Address, Phone and ... as properties in Customer Class?
Like this:


public List<address> addresses {get; set;}
public Contact contact {get; set;}
...

1 solution

Shahin i dont understand what you mean. But my teacher wanted me to have diffrent classes like i have done, i think its stupid too. I want just want ID to start from 100 and add +1 for every new item. Simple as that
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900