?
Solved

Type Error Expected

Posted on 2004-08-04
5
Medium Priority
?
303 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 255 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

764 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