How to update the time for any Item-ListView

Discussion in 'C#' started by shah123, May 8, 2007.

  1. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    Code:
     private void editBtn_Click(object sender, EventArgs e)
            {
                if (scheduleListView.SelectedItems.Count > 0)
                {
    
                    if (scheduleListView.SelectedItems[0].Selected)
                    {
                      
                        scheduleListView.Items.Add(lvt);
                        scheduleListView.Update();
                        scheduleListView.Invalidate();
                    }
                              
            }
    }
    
    I have hour and minute control as DomainUpDown controls and when i change the time for any of those control time should be updated in listview for that selected item. Give me any rough idea please.

    Thanks
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You change the text of the item sub items. How to get the item / sub items you can refer to your previous posts where I have mentioned it.
     
  3. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    I didnt understood what you mean?
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I thought I was clear. Update the content of the items / sub items.
     
  5. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    No Shabbir brother can you be more specific please? Thanks
     
  6. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    Any help. Just some more explanation that what I am doing scheduled application where I have two controls for hour and minutes as DomainUpDown Controls and i have a button as edit. Now the query is when i select any item in ListView and then change the hour and minute for that item and then click on edit which will update the starting time of that event.

    Now the code for edit which i was trying to write as my last thread.
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Code:
    ListViewItem lvi = listView1.Items[0];
    lvi.SubItems[0].Text = "Shabbir";
    It will change the item 0,0 to my name.
     
  8. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    It worked thanks. I got the idea of items and subitems perfectly. Thanks again Shabbit bhai
     
  9. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I think you should have tried the same. You are becoming lazy in trying till you get the code.
     
  10. shah123

    shah123 New Member

    Joined:
    Mar 27, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    ahahhaa... I am not lazy com'n .. and some snippet code or algorithm just makes life easier instead of text :) Anyway thanks Shabbir.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice