Error in designer when inheriting from UserControl

L

larclap

When I try to inherit from the following class in the designer, I get
an error message at the line indicated. It says:

Object reference not set to an instance of an object

I am lost.

Also, if I indicate the class as "Public MustInherit Class ctrlForm",
it does not show up in the list of modules to inherit from.

I appreciate any help on either of these issues, Lars

Public Class ctrlForm
' All forms within MailHouse2 must derive from this class

Public Delegate Sub DisplayMessage(ByVal msg As String)
Private _titleMsg As DisplayMessage
Private _titleString As String = "Hello"

Private Sub ctrlCampaign_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

_titleMsg(_titleString) '<< Error here

End Sub

Public Sub OnDisplayFormTitle(ByVal clientmethod As DisplayMessage)
_titleMsg = clientmethod
End Sub


End Class
 
L

larclap

Thanks for the suggestion, Tony. When I tried:

Public Sub New(ByVal Title As String)
Me.new()
_titleString = Title
_titleMsg(_titleString)
End Sub

It got the error but at runtime, not designtime. Something is different
in a UserControl than a Form. It worked with the original code in a
form.
 

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