ListView problem
-
I have a Object that inherits from ListViewItem. However, when a add this instance to the ListView, there is no text or whatever in it. If I add a SubItem, then the second column is populated but the first still not. How can i display the value on my ListViewItem in the first column ?. Thanks in advance X| Well.. later
-
I have a Object that inherits from ListViewItem. However, when a add this instance to the ListView, there is no text or whatever in it. If I add a SubItem, then the second column is populated but the first still not. How can i display the value on my ListViewItem in the first column ?. Thanks in advance X| Well.. later
When you create your ListViewItem object, the string you pass as a parameter is what will be displayed in the first column. For example
ListViewItem item = new ListViewItem("Text that will be displayed in the first column"); item.SubItem.add("Text that will be displayed in the second column");
Hope this helps Hugo Migneron -
When you create your ListViewItem object, the string you pass as a parameter is what will be displayed in the first column. For example
ListViewItem item = new ListViewItem("Text that will be displayed in the first column"); item.SubItem.add("Text that will be displayed in the second column");
Hope this helps Hugo MigneronWe can pass a ListViewItem to the items.add methods of the ListView, I can't pass a string since a need to put object into the listview. :sigh: Well.. later
-
We can pass a ListViewItem to the items.add methods of the ListView, I can't pass a string since a need to put object into the listview. :sigh: Well.. later
I am not sure i understand correctly what you are saying, can you post your code? Hugo Migneron
-
I am not sure i understand correctly what you are saying, can you post your code? Hugo Migneron
lstServerExplorer.Items.Clear(); foreach( XmlNode node in xn) { strProvider = node.ChildNodes[0].InnerText.ToString(); strServer = node.ChildNodes[1].InnerText.ToString(); strDatabase = node.ChildNodes[2].InnerText.ToString(); strUser = node.ChildNodes[3].InnerText.ToString(); strPassword = node.ChildNodes[4].InnerText.ToString(); itm = new ConnectionItem(strProvider, strServer, strDatabase, strUser, strPassword); lstServerExplorer.Items.Add(itm); }
Where itm is an instance of a class that inherits from ListViewItem. :eek: Well.. later -
lstServerExplorer.Items.Clear(); foreach( XmlNode node in xn) { strProvider = node.ChildNodes[0].InnerText.ToString(); strServer = node.ChildNodes[1].InnerText.ToString(); strDatabase = node.ChildNodes[2].InnerText.ToString(); strUser = node.ChildNodes[3].InnerText.ToString(); strPassword = node.ChildNodes[4].InnerText.ToString(); itm = new ConnectionItem(strProvider, strServer, strDatabase, strUser, strPassword); lstServerExplorer.Items.Add(itm); }
Where itm is an instance of a class that inherits from ListViewItem. :eek: Well.. laterI would say you should call the base ListViewItem constructor in the ConnectionItem consctuctor.
public ConnectionItem(strProvider, strServer, strDatabase, strUser, strPassword):base([whatever you want to display in your first column])
Hope this helps! Hugo Migneron -
I would say you should call the base ListViewItem constructor in the ConnectionItem consctuctor.
public ConnectionItem(strProvider, strServer, strDatabase, strUser, strPassword):base([whatever you want to display in your first column])
Hope this helps! Hugo MigneronYou helped me find the solution. I have used base.Text and it finnally work, thank you so much.;) Well.. later