rgn2121
asked on
Help creating a ToString type of method...
I will try to word this correctly. I know how to create methods for my classes, but not for properties. For instance, The System.Data.DataTable has a Property called TableName. The TableName Property has a number of functions under it, one of which is ToString. How is that created so that it shows up under TableName?
If I do the following:
Dim table as New System.Data.DataTable
table.TableName.ToString
This will give me the name of the table as a string. I am trying to implement a ToCSV, that I would like to use for a test app I use to try things out. I would like to be able to do the following..
Dim table as MyTable
table.Export.ToCSV
I have some skeleton code below...
Any thoughts or comments are much appreciated....
If I do the following:
Dim table as New System.Data.DataTable
table.TableName.ToString
This will give me the name of the table as a string. I am trying to implement a ToCSV, that I would like to use for a test app I use to try things out. I would like to be able to do the following..
Dim table as MyTable
table.Export.ToCSV
I have some skeleton code below...
Any thoughts or comments are much appreciated....
Public Class MyTable
Inherits System.Data.DataTable
sub New
mybase.New()
end sub
Public Property Export()
End Property
Public Function ToCSV() as boolean
End Function
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is what I am not sure about...Normally I pass in a destination file path of where it is to be exported and the table to export.
Sub ExportToCSV()
...Some Code
End Sub
Sub ExportToCSV()
...Some Code
End Sub
ASKER
TechTiger007...I am going to open this in a new question since webtubbs answered my previous question. Please post your previous anser and all subsequent answers there so I can award full points to you both for the answers to my questions.
Thanks...
Thanks...
ASKER
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Wettubs nice. I think you win.
ASKER
Thanks to all...
ASKER
If I was able to do
Dim dt As New MyTable
dt.Export.ToCSV()
Or even simpler
Dim dt As New MyTable
dt.ExportToCSV()
When ever ExportToCSV is called, how does it know what table to export without me passing that table in?