M
Mike
Hello all, I'm trying to work with the openfiledialog and being new to vb
and vb.net I'm having some problems. Wherever I have Me.OpenFileDialog1 I
keep getting the following error:
C:\Visual Studio Projects\ImageLoad\OpenFileDialog1.vb(66):
'OpenFileDialog1' is not a member of 'ImageLoad.OpenFileDialog1'.
Can someone please tell me why and how can I correct it. Here is my code.
Thank you in advance.
Public Class OpenFileDialog1
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
InitializeOpenFileDialog()
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 fileButton As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.fileButton = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'fileButton
'
Me.fileButton.Location = New System.Drawing.Point(128, 168)
Me.fileButton.Name = "fileButton"
Me.fileButton.TabIndex = 0
Me.fileButton.Text = "FileButton"
'
'OpenFileDialog1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.fileButton)
Me.Name = "OpenFileDialog1"
Me.Text = "OpenFileDialog1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub OpenFileDialog1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub fileButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles fileButton.Click
OpenFileDialog1.ShowDialog()
End Sub
Private Sub InitializeOpenFileDialog()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
' Set the file dialog to filter for graphics files.
Me.OpenFileDialog1.Filter = _
"Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"
' Allow the user to select multiple images.
Me.OpenFileDialog1.Multiselect = True
Me.OpenFileDialog1.Title = "My Image Browser"
End Sub
End Class
and vb.net I'm having some problems. Wherever I have Me.OpenFileDialog1 I
keep getting the following error:
C:\Visual Studio Projects\ImageLoad\OpenFileDialog1.vb(66):
'OpenFileDialog1' is not a member of 'ImageLoad.OpenFileDialog1'.
Can someone please tell me why and how can I correct it. Here is my code.
Thank you in advance.
Public Class OpenFileDialog1
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
InitializeOpenFileDialog()
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 fileButton As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.fileButton = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'fileButton
'
Me.fileButton.Location = New System.Drawing.Point(128, 168)
Me.fileButton.Name = "fileButton"
Me.fileButton.TabIndex = 0
Me.fileButton.Text = "FileButton"
'
'OpenFileDialog1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.fileButton)
Me.Name = "OpenFileDialog1"
Me.Text = "OpenFileDialog1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub OpenFileDialog1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub fileButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles fileButton.Click
OpenFileDialog1.ShowDialog()
End Sub
Private Sub InitializeOpenFileDialog()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
' Set the file dialog to filter for graphics files.
Me.OpenFileDialog1.Filter = _
"Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"
' Allow the user to select multiple images.
Me.OpenFileDialog1.Multiselect = True
Me.OpenFileDialog1.Title = "My Image Browser"
End Sub
End Class