Designer Generated Code

G

Guest

Hi all,

Can anyone give me an example of how to change what code the designer will
generate when creating a typed dataset using the VS wizard? I have been
informed that this is possible but have no idea where to look to be able to
do this. For what I am doing, I do not wish to inherrit or extend this
designer generated code.

Jesse
 
B

Brendan Green

If you click the "Show All Files" option in the Solution Explorer, the .CS
file associated with the typed dataset will appear. You can go in here and
make your changes.

Be careful. The .CS file is (I think) generated as part of the build
process, overriding any changes you've made.

If you're using .NET 2.0, look at using partial classes instead to extend
the class instead (I know you said you didn't want to extend, but it may be
safer).
 
G

Guest

Hi Brendan,

Thankyou for you input, I am aware of the points you have made. What I was
really getting at though is being able to change the rules the designer uses
to generate code so that the code it generates is different from what it does
currently. I do not have to use partial class overrides.

Jesse
 
G

Guest

Hi,

I would like to know ho to change the generated code also , because I have
the datasets declared in other project then the UI, and it would be nice to
have acces to the column-properties that are currently declared as "Friend"
instead of "Public".

I prefer to use datatable.DescriptionColumn.Name instead of the hardcoded
string "Description", so that when the columnname changes, a compiletime
error is the result instead of a runtime error. Unfortunalty, the
column-properties are generated as friend, and I have to manually modify them
every time I add/modify a column to the datatable.

The "dataset generated code" is not regenerated as part of building the
project though.

Joris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top