|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Custom Collections : overriding toStringI am having issues with my collection now that i have it mostly together. I am binding it to a listbox, but instead of the box information I want it to show, it is simply showing the object type. I have tried overriding it with the following.
Public Overrides Function toString() As String Dim result As System.Text.StringBuilder Dim item As Box For Each item In Me.List result.Append(item.BoxType.ToString) Next End Function I found something similar to that on the net and modified it for how I think it should work. But its still not working...any ideas? -- --Eric Cathell, MCSA Have you set the "DisplayMember" property of the ListBox to the property of
the collection you want to show? The default member in a standard collection is "Item", and when using a standard collection you do not have to set "DisplayMember", but maybe you have altered the properties, and will have to point the ListBox in the right direction. Show quoteHide quote "ECathell" wrote: > I am having issues with my collection now that i have it mostly together. I am binding it to a listbox, but instead of the box information I want it to show, it is simply showing the object type. I have tried overriding it with the following. > > > Public Overrides Function toString() As String > Dim result As System.Text.StringBuilder > Dim item As Box > For Each item In Me.List > result.Append(item.BoxType.ToString) > Next > End Function > > > I found something similar to that on the net and modified it for how I think it should work. But its still not working...any ideas? > -- > --Eric Cathell, MCSA ECathell wrote:
> I am having issues with my collection now that i have it mostly together. I am binding it to a listbox, but instead of the boxinformation I want it to show, it is simply showing the object type. I have tried overriding it with the following. > I think it should work. But its still not working...any ideas?> > Public Overrides Function toString() As String > Dim result As System.Text.StringBuilder > Dim item As Box > For Each item In Me.List > result.Append(item.BoxType.ToString) > Next > End Function > > > I found something similar to that on the net and modified it for how Umm... Return result.ToString ? -- Larry Lard Replies to group please I figured it out. I think it may have been a pretty silly error. I was trying to override the toString function in my collection class to return the name of the object. I had to Override the toString Method in my COLLECTED class to return the information I wanted displayed.
Thanks to dave Hayden at http://codebetter.com/blogs/david.hayden/archive/2005/02/24/55984.aspx for knocking me upside my head. -- --Eric Cathell, MCSA "ECathell" <ecathell@nospam.mountaire.com> wrote in message news:eEAD74QQFHA.2136@TK2MSFTNGP14.phx.gbl... I am having issues with my collection now that i have it mostly together. I am binding it to a listbox, but instead of the box information I want it to show, it is simply showing the object type. I have tried overriding it with the following.Public Overrides Function toString() As String Dim result As System.Text.StringBuilder Dim item As Box For Each item In Me.List result.Append(item.BoxType.ToString) Next End Function I found something similar to that on the net and modified it for how I think it should work. But its still not working...any ideas? -- --Eric Cathell, MCSA
Why use Events?
[Datable] change column datatype ownerdraw menu, help appreciated VB6 - Unable to read Text File Custom collections Best way to get the value of one particular node of an XML string Crystal Report Database Change iHttpModule and Virtual Directories Application class problem Stupid DLL's! |
|||||||||||||||||||||||