[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Type Error Expected

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

656 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