Inherited Form

H

Herman Lammers

Hi,

i have this weird problem with Inherited Forms. I have a Form with some
standard functionality from which I inherit other forms.

Whenever I modify the Base Form, the designer does not open the inherited
Form in designmode anymore. It gives the following error message:

An error ocurred while loading the document. Fix the error, and then try
loading the document again. The error message follows:
The argument Path is nothing or empty.

Anyone any ideas?

Thanks

Herman
 
J

Jan Tielens

If you alter the base form, you should always recompile the project. Did you
do that?
 
H

Herman Lammers

Hi Jan,

thanks for your response.

Yes i did. I explicitly rebuilt the module that contains the base form.
Rebuilt the project that contains the inherited form, rebuilt the entire
solution ....

No Success

In a test environment i contained the base form and the inherited form in a
single project... With the same result.

Here is the code for the base class :

Public Class AIPForm

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

components = New System.ComponentModel.Container()

Me.Text = "AIPForm"

End Sub

#End Region

Const WM_KEYDOWN = &H100

Const WM_KEYUP = &H101

Const WM_SYSKEYDOWN = &H105

Public Overridable Sub UndoChanges()

End Sub

Public Overridable Sub UpdateDataset()

End Sub

Public Overridable Sub MoveFirst()

End Sub

Public Overridable Sub MovePrevious()

End Sub

Public Overridable Sub MoveNext()

End Sub

Public Overridable Sub MoveLast()

End Sub

Public Overridable Sub AddNew()

End Sub

Public Overridable Sub Delete()

End Sub

Public Overridable Sub SetFilter(ByVal cFilter As String)

End Sub



'Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean

' If msg.Msg = WM_KEYDOWN Then

' Select Case keyData

' Case Keys.Return

' Me.ProcessDialogKey(Keys.Tab)

' Return True

' End Select

' End If

' Return MyBase.ProcessCmdKey(msg, keyData)

'End Function



Public Overridable Sub AIPForm_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

SaveSetting(Application.ProductName, Me.Name, "Width", CStr(Me.Width))

SaveSetting(Application.ProductName, Me.Name, "Height", CStr(Me.Height))

End Sub

Public Overridable Sub AIPForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.Width = CInt(GetSetting(Application.ProductName, Me.Name, "Width",
CStr(Me.Width)))

Me.Height = CInt(GetSetting(Application.ProductName, Me.Name, "Height",
CStr(Me.Height)))

End Sub



End Class
 
H

Herfried K. Wagner [MVP]

* "Herman Lammers said:
i have this weird problem with Inherited Forms. I have a Form with some
standard functionality from which I inherit other forms.

Whenever I modify the Base Form, the designer does not open the inherited
Form in designmode anymore. It gives the following error message:

An error ocurred while loading the document. Fix the error, and then try
loading the document again. The error message follows:
The argument Path is nothing or empty.

Mark out the base form's '<System.Diagnostics.DebuggerStepThrough>'
temporarily and check where the exception occurs.
 
H

Herman Lammers

Hi,

i think i solved the issue. In the base class I wrote code (in the Load
event of the form, and I also tried to override the Base classes OnLoad
method), where I read the last width and height of the form from the
registry, and modify the width and height properties of the form.

Now I put this code in a Try .. Catch block, and it seems to work OK. (Never
realized that during design time this code would be executed though. Just
curious : is there a kind of directive to prevent code from being executed
during design time?)

Again thanks for your replies!

Herman
 

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