Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

One year after a similare question has been posted on SO. Generic Windows Form Template

Do you know if there're a better way to make a windows form generic, here's what I'd like to do:

public partial class EntryPointEditForm<T>  : Form where T : ICriteriaObject<T>
{}

But an error is thrown telling me that: no suitable method found to override
on the method:

protected override void Dispose(bool disposing)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
165 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to change the partial class declaration in the .Designer.cs file to also be generic.

However, I don't think that the VS designer supports generic form classes.
You may need to make a non-generic abstract form to use with the designer, then make a generic class that inherits from it for you to actually use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...