Ok guys I need some help why I am getting this error and how do I fix this:'Handles clause requires a withevent variable defined in the containing type or one of its base types'

Code below Error occurs on line 14:

Imports System.ComponentModel
Imports System.Text
Imports DevComponents.DotNetBar.Metro
Imports DevComponents.DotNetBar

Namespace MetroTilePanel
    Partial Public Class Form1
        Inherits MetroForm
        Public Sub New()
            StyleManager.MetroColorGeneratorParameters = New DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(ColorScheme.GetColor("0E6D38"), ColorScheme.GetColor("0E6D38"))
            InitializeComponent()
        End Sub

Private Sub metroTilePanel1_ItemClick(sender As System.Object, e As System.EventArgs) Handles metroTilePanel1.ItemClick
            Dim Proc As New System.Diagnostics.Process
            Proc.StartInfo.WorkingDirectory = "D:\"
            Proc.StartInfo.FileName = "index.jpg"
            Proc.Start()
        End Sub
    End Class
End Namespace

Have you verified that metroTilePanel1 exists?

Have you checked to see if it has been renamed by accident?

If not, you can add the sub as a handler manually by deleting the "Handles metroTilePanel1.ItemClick" off of the end and:

'Add this to your form load.'


addHandler metroTilePanel1.ItemClick, Address Of metroTilePanel1_ItemClick

'This will manually add the event.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.