Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a listview with 2 columns and I need to know how to put things in the second column. When I do a:
lvwTeams.Items.Add(myReader.GetValue(6) & " (" & myReader.GetValue(2) & myReader.GetValue(3) & ")")

it only puts thing in the first column. How do I do this??

Thanks,

Tehon

Posted
in vb6, (im sure its the same now) the add method would return a listItem (not sure what its called now), then you could do listItem.SubItems(X) and set the other columns. Same way with a tree view and tree nodes in .NET (only similar control ive used in .net) - im sure there will be additional .Add signitures so you can add listItems staight off.

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

Posted
OK...Now I don't know how many rows I will have since I am getting this from an SQL table. So how would I create these "items1, items2..." on the fly?

Thanks,

Tehon

  • Moderators
Posted

The "1" can be an everchanging field value from the table (dataReader)

item1.SubItems.Add("1")

[edit]

In the CreateMyListView routine, there is no loop but obviously you will have a loop.... While MyReader....

[/edit]

Visit...Bassic Software
Posted

define a Litem as listviewitem

 

then

 

Litem= lvwTeams.Items.add...(whatever)

Litem.subitems.add (thats your second col..)

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...