Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 19th, 2008, 6:20 AM   #1
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
Problem adding an item to the subitem (listview)

Im having trouble adding a subitem in a listview with an item in it and a subitem and another subitem... what i mean is this... i have no problem adding an item to a list view with just one subitem, but if the listview have several subitems i have trouble adding the string to the third subitem(third coloumn actually)... here is the code in which i have no problem adding an item with just one subitem

c# Syntax (Toggle Plain Text)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Lists_and_Trees
  11. {
  12. public partial class ListsAndTreesForm : Form
  13. {
  14. public ListsAndTreesForm()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void btnAdd_Click(object sender, EventArgs e)
  20. {
  21. string name = txtName.Text.ToString();
  22. string state = txtState.Text.ToString();
  23. string gender = comboGender.Items.ToString();
  24.  
  25. ListViewItem objListItem;
  26. objListItem = listView.Items.Add(name, 0);
  27. objListItem.SubItems.Add(state);
  28.  
  29. }
  30. }

right here i have no idea in adding the third sub item which is the gender(line 23)....
please help... please bear with me, i have a difficult time in my english... thank you
I am just beginning programming in visual c#.... thanks again
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote
Old Jul 19th, 2008, 9:54 AM   #2
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: Problem adding an item to the subitem (listview)

The first item you add to a row is the item, the rest will be an array of subitem, if that helps you. So, subitem[0], subitem[1], etc.
Jabo is offline   Reply With Quote
Old Jul 19th, 2008, 10:06 AM   #3
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
Re: Problem adding an item to the subitem (listview)

Quote:
Originally Posted by Jabo View Post
The first item you add to a row is the item, the rest will be an array of subitem, if that helps you. So, subitem[0], subitem[1], etc.
thanks dude... it gives me an idea... ill check it out tomorow... time to sleep now...its almost 1am here in my place
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cration of a new control, problem with adding new controls beni_dude C# 5 Apr 15th, 2008 4:31 PM
Problem solving ReggaetonKing Software Design and Algorithms 7 Jan 4th, 2008 1:49 PM
Problem Associated with Vector Source code buggytoast Java 3 Apr 2nd, 2006 5:41 AM
Various ListView questions Eleo C# 6 Feb 16th, 2006 11:32 PM
ListView foreach subitem tayspen C# 2 Nov 25th, 2005 8:49 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC