Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

listview

variable type

  • Please log in to reply
13 replies to this topic

#13 Siten0308

Siten0308

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 298 posts

Posted 11 December 2008 - 04:29 PM

cool thanks Xav for that,

sorry to ask one last question what if you had multiple textboxes, would your declare each textbox giving it its own variable then putting all variables together in one dictionary collection? if that is the case would the listview.items.add("put dictionary name here"?) would that be right?
  • 0

#14 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 12 December 2008 - 09:14 AM

ListView.Items.Add() expects a string value. If you wish to add more than one column to the list view (in Details view) then you can manipulate SubItems:

Button1_Click(EventArgs e, object sender)
{
  Form2 frm = new Form2();
  if (frm.ShowDialog() != DialogResult.OK) return;
  
  ListViewItem row = listView1.Items.Add(frm.textBox1.Text);

  row.SubItems.Add(frm.textBox2.Text);
  row.SubItems.Add(frm.textBox3.Text);
  //etc.
}

  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?





Also tagged with one or more of these keywords: variable type

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download