Solved

Type Error Expected

Posted on 2004-08-04
5
287 Views
Last Modified: 2008-03-06
For learning purposes , I created a dialog form as a .dll file and another form which I use to call the dialog form with the button.  I get a type error expected and i don't know why.  The code is correct.  Is the 'type error expected' expecting a type cast?
This is the line that causes it but i'm pretty sure its correct way.
Dim frmAbout As New AboutDialog ' type expected error

Scroll down to the bottom and you'll find that line (button click event)

Imports AboutDialog
Public Class frmAbout
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.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents btnAbout As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.btnAbout = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Arial Black", 24.0!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(32, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(504, 48)
Me.Label1.TabIndex = 0
Me.Label1.Text = "About Dialog"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("Arial", 20.25!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(24, 88)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(504, 32)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Click the button to test the About Dialog"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'btnAbout
'
Me.btnAbout.Location = New System.Drawing.Point(200, 176)
Me.btnAbout.Name = "btnAbout"
Me.btnAbout.Size = New System.Drawing.Size(176, 32)
Me.btnAbout.TabIndex = 2
Me.btnAbout.Text = "About..."
'
'frmAbout
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 266)
Me.Controls.Add(Me.btnAbout)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "frmAbout"
Me.Text = "SCC313 Practical"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub btnAbout_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnAbout.Click
Dim frmAbout As New AboutDialog ' type expected error

frmAbout.ProjectID = "Prac 2"
frmAbout.ProjectName = "A Reusable About Dialog"
frmAbout.ShowDialog()
End Sub
End Class

0
Comment
Question by:gbilios
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11713728
what is the name of your form and the name of your referenced DLL ?

because the error indicates that you only reference the dll not the form itself

I would expect it to be something like

Dim frmAbout As New AboutDialog.form1
0
 

Author Comment

by:gbilios
ID: 11713820
The .dll file is called AboutDialog.dll
The dialog form is called AboutDialog.vb
The form to call the dialog form is called frmAbout
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 85 total points
ID: 11713840
then try

Dim frmAbout As New AboutDialog.AboutDialog
0
 

Author Comment

by:gbilios
ID: 11713872
then why not

frmAbout As New AboutDialog
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11713885
it gets confused because you use the same name for both the dll and the form
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now