BusinessObject.ToString


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I am using the Business Objects ToString method to return the name of the business object. I have attached a sample project that illustrates what is going on.

I am using a routine that uses reflection to loop through each business object in an assembly and generate's a html help documentation file, I name these files using the business object tostring method. So for instance the filename might be Businessobject1.htm.

 hohever If I call the same business objects ToString method from within a form I end up with [Businessobject1].htm. It seems the [] brackets are being added.

Paul

Attachments
Test.Zip (134 views, 48.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This is actually .NET adding this as we do not override the ToString() method. Instead of getting into why, etc. just call the ToString() of the type:



Console.WriteLine(Me.BusinessObject11.GetType().ToString())




This will give you what you are wanting. My second question would be....why are you writing this? SandCastle is free and it does this for you. You could also buy tools such as DocumentX from Innovasys...but SandCastle is better, free, and what Microsoft uses.
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Hi Trent,

I thought perhaps you guys were overriding the method for some reason, so did not look past that. As for why I am doing this...

I am outputing end user help. In my base form code I have attibutes and property's that are specific to generating and displaying user help. I then read through the project using reflection and generate a html help style docs for Forms that contain specific custom attributes etc. I can then generate specific info on bound controls , required fields , business rules , change logs as well as custom property's. once the html file is generated I then set a property  containing the URL of the generated page so when the user hits the help button or F1 from the form it will call System.Windows.Forms.Help.ShowHelp and pass in the correct help url to the CHM that is generated.

I have not used Sandcastle it but it looks like it generates class documention more geared to the developer. I am not sure that it would fit in what I am doing 

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Gotcha, just curious Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search