cjard
Well-known member
- Joined
- Apr 25, 2006
- Messages
- 7,081
- Programming Experience
- 10+
I'm told that vb interfaces cannot have default implementations..
so, how can i ease my workload if i have a situation where i want to make a form in my app searchable, the search routine is always the same (it loops through all the controls on the form, collects values from them, forms an sql and runs it) and i want to offer it on all forms in the app
if i could provide a default implementation in an interface, i could jsut write the interface, and say that the form implements it and bingo, the form has the functionality to be searchable. some aspects would need implementing ona per form basis of course, but the main search sql builder is a fixed logic that i dont want to have to apste into every form
another option is inheriting the form, i.e. i make a SearchableForm that inherits form, then make every form in my app a SearchableForm. I think the IDE will break down in tears if i do that because it seems so tied to its forms that it's an unbreakable
My current woraround that i regard as a bit lame is to have a searchengien class that takes a form as a parameter to a sub. the sub will rip throught he form, build a sql, run it and show the results in another window. upon double click of a certain result, the original form will show some details. i'll probably use a delegate to do this, or make the searchengien a form itself, so it can show its own results, and having direct access to the form to which it relates, can cause a new showing of the results
im wondering if anyone has any other suggestions with this quandary?
so, how can i ease my workload if i have a situation where i want to make a form in my app searchable, the search routine is always the same (it loops through all the controls on the form, collects values from them, forms an sql and runs it) and i want to offer it on all forms in the app
if i could provide a default implementation in an interface, i could jsut write the interface, and say that the form implements it and bingo, the form has the functionality to be searchable. some aspects would need implementing ona per form basis of course, but the main search sql builder is a fixed logic that i dont want to have to apste into every form
another option is inheriting the form, i.e. i make a SearchableForm that inherits form, then make every form in my app a SearchableForm. I think the IDE will break down in tears if i do that because it seems so tied to its forms that it's an unbreakable
My current woraround that i regard as a bit lame is to have a searchengien class that takes a form as a parameter to a sub. the sub will rip throught he form, build a sql, run it and show the results in another window. upon double click of a certain result, the original form will show some details. i'll probably use a delegate to do this, or make the searchengien a form itself, so it can show its own results, and having direct access to the form to which it relates, can cause a new showing of the results
im wondering if anyone has any other suggestions with this quandary?