Hi everybody,

I have made a web form class which I want to use as a base class for all data entry web forms. Following is the structure of the web form:

VB Code:
  1. Public Class WFrmEnt
  2.     Inherits System.Web.UI.Page
  3.     Protected WithEvents nLast As System.Web.UI.WebControls.ImageButton
  4.     Protected WithEvents nNext As System.Web.UI.WebControls.ImageButton
  5.     Protected WithEvents nPrev As System.Web.UI.WebControls.ImageButton
  6.     Protected WithEvents nCancel As System.Web.UI.WebControls.Button
  7.     Protected WithEvents nSave As System.Web.UI.WebControls.Button
  8.     Protected WithEvents nMessage As System.Web.UI.WebControls.Label
  9.     Protected WithEvents nDelete As System.Web.UI.WebControls.Button
  10.     Protected WithEvents nModify As System.Web.UI.WebControls.Button
  11.     Protected WithEvents nAdd As System.Web.UI.WebControls.Button
  12.     Protected WithEvents nPrint As System.Web.UI.WebControls.Button
  13.     Protected WithEvents nFilter As System.Web.UI.WebControls.Button
  14.     Protected WithEvents nFirst As System.Web.UI.WebControls.ImageButton
  15.     Protected WithEvents nRemoveFilter As System.Web.UI.WebControls.Button
  16.  
  17.     Private Sub nFirst_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles
  18.  
  19. nFirst.Click
  20.         Navigate(CNavAction.First)
  21.     End Sub
  22.  
  23.     Private Sub nPrev_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nPrev.Click
  24.         Navigate(CNavAction.Prev)
  25.     End Sub
  26.  
  27.     Private Sub nNext_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nNext.Click
  28.         Navigate(CNavAction.Next)
  29.     End Sub
  30.  
  31.     Private Sub nLast_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nLast.Click
  32.         Navigate(CNavAction.Last)
  33.     End Sub
  34.  
  35.     Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
  36.         MyBase.Render(writer)
  37.     End Sub
  38.  
  39. End Class

For making a data entry web form, I first add a new web form and place all the required controls on it including nAdd, nModify, nDelete, nFirst, nNext, nPrev, etc. After that, in the code behind page, I change the clause "Inherits System.Web.UI.Page" to "Inherits WFrmEnt". Everything works fine.
But my problem is that when I go to the designer screen of the web form, it inserts the declarations for the variables of the controls that are inherited from the base web form. It inserts the following code:

VB Code:
  1. Protected WithEvents nLast As System.Web.UI.WebControls.ImageButton
  2.     Protected WithEvents nNext As System.Web.UI.WebControls.ImageButton
  3.     Protected WithEvents nPrev As System.Web.UI.WebControls.ImageButton
  4.     Protected WithEvents nCancel As System.Web.UI.WebControls.Button
  5.     Protected WithEvents nSave As System.Web.UI.WebControls.Button
  6.     Protected WithEvents nMessage As System.Web.UI.WebControls.Label
  7.     Protected WithEvents nDelete As System.Web.UI.WebControls.Button
  8.     Protected WithEvents nModify As System.Web.UI.WebControls.Button
  9.     Protected WithEvents nAdd As System.Web.UI.WebControls.Button
  10.     Protected WithEvents nPrint As System.Web.UI.WebControls.Button
  11.     Protected WithEvents nFilter As System.Web.UI.WebControls.Button
  12.     Protected WithEvents nFirst As System.Web.UI.WebControls.ImageButton
  13.     Protected WithEvents nRemoveFilter As System.Web.UI.WebControls.Button

However, this is not desirable because these declarations are already present in the base web form class. Is there a way to avoid this automatic insertion of undesired code?