Solved

Type Error Expected

Posted on 2004-08-04
5
288 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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