Reputation: 11
It is using for creating a food menu. User will choice some foods and drinks from ProductListView. User selects products and click to add to menu button and system adds products to ListView.
Product information includes product name and unit price such as(Hamburger, Baked potato, Spinach puree and Coca-Cola). Now there are 5 products and 5 prices. Now I want to save this menu's information. User will enter menu name and save. Menu price will take automatically.
My problem is starting here. Menu's description should be like that Hamburger,Baked patato, Spinach puree and Coca-Cola so I want to add listview's items to textbox as description.
Upvotes: 0
Views: 931
Reputation: 1331
Lets say you have three columns in listview1
( product, price, quantitity) and you want to show selected items in a textbox called txtResult:
productName = listView1.SelectedItems[0].SubItems[0].Text;
productPrice = listView1.SelectedItems[0].SubItems[1].Text;
productQuantity = listView1.SelectedItems[0].SubItems[2].Text;
txtResult.text = productName + " , " + productPrice + " , " + productQuantity;
Upvotes: 1
Reputation: 641
Adding text to a textbox from a listview would work something like this (without more details I can't be more direct)
TextBox1.AppendText(ListView1.SelectedItems[0].Text);
this would add the text from the first selected item in the listview to the text box. You would add code like above to your button click handler
Upvotes: 0