3 Replies - 1154 Views - Last Post: 08 August 2009 - 05:14 AM Rate Topic: -----

#1 Jarrhed   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 84
  • Joined: 01-January 09

Changing text from a string variable on a textlistbox

Post icon  Posted 05 August 2009 - 09:43 PM

I'm trying to add text with special properties to the listbox thats specificed what to ad in the code from the xml file and it's saying that Insert only takes one argument

Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace Reformer
{
	public partial class Multi_Action : Form
	{
		public Multi_Action()
		{
			InitializeComponent();
		}

		private void Multi_Action_Load(object sender, EventArgs e)
		{
			XmlDocument xDoc = new XmlDocument();
			//Loading Distribution File
			xDoc.Load("Distribution.xml");
			//NodeList to retrieve data from "choice"
			XmlNodeList choicelist = xDoc.GetElementsByTagName("choice");
			//Do something for each node in choicelist
			foreach (XmlNode node in choicelist)
				{

					XmlElement choicelement  = (XmlElement) node;
					string title_choicelement = choicelement.GetElementsByTagName("title")[0].InnerText;
					string description_choicelement = choicelement.GetElementsByTagName("description")[0].InnerText;
					ItemListBox_MultiAction_listbox.Text.Insert(title_choicelement);
				   // if (choicelement.HasAttributes)
						//{

							//isbn = choicelement.Attributes["ISBN"].InnerText;
					   // }
				}

		 } 
		   



		}
	}



When I try to use ItemListBox_MultiAction_listbox.Items.Add(title_choicelement); instead of Insert the application crashes

This post has been edited by Jarrhed: 05 August 2009 - 09:56 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Changing text from a string variable on a textlistbox

#2 Jarrhed   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 84
  • Joined: 01-January 09

Re: Changing text from a string variable on a textlistbox

Posted 06 August 2009 - 10:27 AM

bump
Was This Post Helpful? 0
  • +
  • -

#3 Jarrhed   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 84
  • Joined: 01-January 09

Re: Changing text from a string variable on a textlistbox

Posted 07 August 2009 - 07:24 PM

bump #2 - nobody can help me?
Was This Post Helpful? 0
  • +
  • -

#4 Renagado   User is offline

  • D.I.C Regular
  • member icon

Reputation: 118
  • View blog
  • Posts: 388
  • Joined: 14-June 09

Re: Changing text from a string variable on a textlistbox

Posted 08 August 2009 - 05:14 AM

So when you use ItemListBox_MultiAction_listbox.Items.Add(title_choicelement); and it crashes, exactly what error do you get?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1