1,105,328 Community Members

Public Overrides Function ToString()

Member Avatar
Newbie Poster
23 posts since Sep 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

Can someone explain to me how this function works in relation to a GUI output.

Public Overrides Function ToString() As String

My program do some calculation and conversions and displays the resluts in a list box. I need use this function but i am not sure how it affects my output.

Member Avatar
Veteran Poster
1,039 posts since Aug 2008
Reputation Points: 189 [?]
Q&As Helped to Solve: 208 [?]
Skill Endorsements: 9 [?]

ToString() gives the textual respresentation of the object. This means with numbers that, for example, number 3 gets displayd as string "3".
ToString() also accepts format string as a parameter and this gives the full power of it. For example -123.ToString("X") returns hexadecimal representation of the number (=FFFFFF85).
You can read more about string formsts from the MSDN documentation.
Since it's overridable method you can have your own implementation of it in your own class.

Question Answered as of 5 Years Ago by Teme64
This question has already been solved: Start a new discussion instead
Start New Discussion
Tags Related to this Article