Jul 14, 2011
I have a VB.NET project in Visual Studio 2008 that I created a specialized addin for. The addin prompts the user to select a database table, takes a template form class's files, copies them to another directory within the project, and renames the form class within the copied files. It then opens the new form and adds controls to it based on the fields in the database table.
View 1 Replies
The copying of the template form causes the background compiler to give 'duplicate member' errors, such as "Private Sub InitializeComponents(...) has multiple definitions with identical signatures," even though I renamed the files of the new form and the class name within them. Sometimes these errors go away before the new form is opened, but when they stick around the new form doesn't open correctly, and it throws an error instead. I implemented some code to wait until there are zero errors in the error list before trying to open the new form. This has helped sometimes, but for some reason sometimes the errors don't go away at all until the addin is closed.
How to copy the template form and rename the copy without the background compiler ever noticing duplicate members. If that's not possible, then perhaps someone has an alternative?
Here is my code that copies and renames the template form:
Private Sub CreateDataForm(ByVal tableName As String, ByVal displayName As String) ', ByVal subDataForms As IList(Of Object))
Dim dataFormClassName As String = "frm" & MakeValidName(displayName)
Dim dataFormFileName As String = dataFormClassName & cVBSuffix