Forms inheritance problem

  • Thread starter Sergey Poberezovskiy
  • Start date
S

Sergey Poberezovskiy

Hi,

I created two base forms: frmList and frmDetail, compiled
them into a dll, and then want to use in my new project.
The problem: When I created new inherited form, say
frmClients, I cannot load the form in design view - the
IDE complains with
"Argument 'Path' is Nothing or empty." error.

It does not stop however the project to compile, and even
works correctly while running the project.

Unfortunately, I cannot add controls on the form
(frmClients) in design view - the IDE simply won't load
it.

Does anyone know what may be the problem and how to fix
it?

Any help will be greatly appreciated.
 
O

One Handed Man

I dont think this is possible. The reason for this is that once you have
compiled it into a library, non of the source information is then available
for the IDE using that reference.

I suggest that you complete your design and debug it and fully test it, once
you have done this you can then put the form into a library.

Regards - OHM
 
S

Sergey Poberezovskiy

There is something wierd happening - I cannot event load
an inherited form within the dll project - event though I
can easily load both frmList and frmDetail in design view.

Any ideas?..
 
O

One Handed Man

OOps. Sorry, I dont think I can help you further on this as its not
something I normally do, Perhaps you could repost the question again and I
will not take part. That way maybe you will get an answer.

Regards - OHM
 
C

Chris Dunaway

Unfortunately, I cannot add controls on the form
(frmClients) in design view - the IDE simply won't load
it.

Does your form class have a constructor that takes NO arguments? That is
necessary for the form designer to be able to instantiate it. Can you show
us the code for the form class and information on the constructors?
 
S

Sergey Poberezovskiy

Every form has an overloaded constructor, but one without
parameters amongst them. The code for the frmDetail, and
frmClient is as follows:

frmDetail:

Imports System.Windows.Forms

Namespace Forms
Public Class frmDetail
Inherits System.Windows.Forms.Form

Protected _id As Int32
Protected _openMode As Constants.FormOpenMode
Private _detailName As String =
Constants.EmptyString

#Region " Windows Form Designer generated code "

#Region " Constructor"
Public Sub New()
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
End Sub

Public Sub New(ByVal parentMDI As Form)
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
Me.ParentMDI = parentMDI
End Sub

Public Sub New(ByVal detailName As String)
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
Me.DetailName = detailName
End Sub

Public Sub New(ByVal parentMDI As Form, ByVal
detailName As String)
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
Me.ParentMDI = parentMDI
Me.DetailName = detailName
End Sub
#End Region

'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.
Protected Friend WithEvents btnSave As
System.Windows.Forms.Button
Protected Friend WithEvents btnCancel As
System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.btnSave = New System.Windows.Forms.Button
Me.btnCancel = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'btnSave
'
Me.btnSave.Anchor = CType
((System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.btnSave.DialogResult =
System.Windows.Forms.DialogResult.Cancel
Me.btnSave.Location = New System.Drawing.Point
(175, 298)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(70,
25)
Me.btnSave.TabIndex = 19
Me.btnSave.Text = "&Save"
'
'btnCancel
'
Me.btnCancel.Anchor = CType
((System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.btnCancel.DialogResult =
System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.Location = New
System.Drawing.Point(284, 298)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size
(70, 25)
Me.btnCancel.TabIndex = 17
Me.btnCancel.Text = "&Cancel"
'
'frmDetail
'
Me.AutoScaleBaseSize = New System.Drawing.Size
(5, 13)
Me.ClientSize = New System.Drawing.Size(367,
332)
Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.btnCancel)
Me.MinimumSize = New System.Drawing.Size(375,
370)
Me.Name = "frmDetail"
Me.ResumeLayout(False)

End Sub
#End Region

#Region " Public Properties"
Public Property Id() As Int32
Get
Return _id
End Get
Set(ByVal Value As Int32)
If Not _id.Equals(Value) Then
_id = Value
sbSetFormText()
If Not Value.Equals(0) Then
sbSetRecord()
End If
End If
End Set
End Property

Public Property DetailName() As String
Get
Return _detailName
End Get
Set(ByVal Value As String)
_detailName = Value
End Set
End Property

Public WriteOnly Property ParentMDI() As Form
Set(ByVal Value As Form)
Me.MdiParent = Value
End Set
End Property

Public WriteOnly Property OpenMode() As
Constants.FormOpenMode
Set(ByVal Value As Constants.FormOpenMode)
_openMode = Value
sbSetFormText()
sbSetControlsMode()
End Set
End Property
#End Region

#Region " Private routines"
Protected Overridable Sub sbSetControlsMode()

End Sub

Protected Overridable Sub sbSetRecord()

End Sub

Protected Overridable Function fnCheck() As
Boolean

End Function

Protected Overridable Sub sbSetFormText()
Select Case _openMode
Case Constants.FormOpenMode.newRecord
Me.Text = "Create New " & _detailName
Case Constants.FormOpenMode.editRecord
Me.Text = "Modify " & _detailName
& " " & _id.ToString
Case Constants.FormOpenMode.viewRecord
Me.Text = "View " & _detailName & " "
& _id.ToString
End Select
End Sub
#End Region

Private Sub frm_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
General.SetFormPosition(Me)
End Sub

Private Sub frm_Closing(ByVal sender As Object,
ByVal e As System.ComponentModel.CancelEventArgs) Handles
MyBase.Closing
General.SaveFormPosition(Me)
Me.Dispose()
End Sub

Private Sub btnCancel_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnCancel.Click
Me.Close()
End Sub

End Class
End Namespace

And frmClient:

Friend Class frmClient
Inherits BaseClasses.Forms.frmDetail

#Region " Windows Form Designer generated code "
#Region " Constructor"
Public Sub New()
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
End Sub

Public Sub New(ByVal openMode As
Constants.FormOpenMode)
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
Me.OpenMode = openMode
End Sub

Public Sub New(ByVal parentMDI As Form)
MyBase.New(parentMDI)
'This call is required by the Windows Form
Designer.
InitializeComponent()
End Sub

Public Sub New(ByVal parentMDI As Form, ByVal
openMode As Constants.FormOpenMode)
MyBase.New(parentMDI)
'This call is required by the Windows Form
Designer.
InitializeComponent()
Me.OpenMode = openMode
End Sub
#End Region

'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 = "frmClient"
End Sub
#End Region

#Region " Overrides"
Protected Overrides Sub btnSave_Click(ByVal sender As
Object, ByVal e As System.EventArgs)

End Sub
#End Region

Protected Overrides Function fnCheck() As Boolean

End Function

Protected Overrides Sub sbSetControlsMode()

End Sub

Protected Overrides Sub sbSetRecord()

End Sub
End Class

There isn't much code in those as I cannot add controls
to it...
-----Original Message-----
 
A

Anand Balasubramanian

Hi,
I have a suggestion that you can try out. Sometimes these types of weird
errors occur when one of the system dlls copylocal property is set to
true. So please check properties of the system dlls in your references
section and make sure their copylocal property is set to false. SAve the
project and then reload it and see if you can get into the desinger.

Thanks
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks
 

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