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"))
        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"
        End Sub
    End Class
End Namespace

Edited 4 Years Ago by TIM_M_91

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.
This article has been dead for over six months. Start a new discussion instead.