0

So I have a huge class hierarch I am working with. I would like to store the objects of these classes in a ListBox and have a certain attribute used for the ListBox text. So my plan is to make a User Control and inherit from the ListBox. Is there a function that I can override that will let me print what I want for the ListBox text?
Ps I do not want to override the toString functions in my other classes

1
Contributor
2
Replies
3
Views
9 Years
Discussion Span
Last Post by rp90
0

Is there a better place to post this question so I can get a reply faster? I really need an answer to this question fast

0

OK so ic an now draw a diffrent string by using the following code

private sub myList(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles MyBase.DrawItem
        If Me.Items.Count > 0 Then
            e.DrawBackground()

            e.Graphics.DrawString("SomeText", e.Font, New SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y)
        End If
    End Sub

However I do not get the horizontal scroll bar anymore!?!?!? How do I get that back?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.