Solved

Type Error Expected

Posted on 2004-08-04
5
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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