I'm trying to create list view which has five columns. Text in list view depends on a selection in a combo box that I have. Depending on that selection program reads xml and fulfill's first three columns. Fourth column should be a text box and fifth should be a result of a calculation.
Here I have a problem because I don't now how to create text box in fourth column. I have something like this:
foreach (XmlNode node in chosen)
{
XmlElement element = (XmlElement)node;
string name = element.GetElementsByTagName("Name")[0].InnerText; //get name of product
string price= element.GetElementsByTagName("Price")[0].InnerText; //get price of product
string id = "";
if (element.HasAttributes) //remove to zeros from beginning (because they are writen like 001 and I want just 1 at output)
{
id = element.Attributes["ID"].InnerText;
int idd = int.Parse((string)id); //Parsing seems like the easiest way to do that
id = idd.ToString();
}
list = lvindex.Items.Add(id + "."); //first i put a number and dot
list.SubItems.Add(ime); //then the name of a product
list.SubItems.Add(cijena + "EUR"); //Then price of it
//Here I miss fourt and five columns because I don't know to createtext box in listview therefore I cant calculate the fifth column which should be a third column times fourth column
}
Question
neocooler
I'm trying to create list view which has five columns. Text in list view depends on a selection in a combo box that I have. Depending on that selection program reads xml and fulfill's first three columns. Fourth column should be a text box and fifth should be a result of a calculation.
Here I have a problem because I don't now how to create text box in fourth column. I have something like this:
Can anybody help? I can't find anything online...
Thank in advance :)
Link to comment
https://www.neowin.net/forum/topic/609198-c-text-box-in-list-view/Share on other sites
10 answers to this question
Recommended Posts