• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

How to add Click and MouseHover events evet to control. Control creates at run time.

Hello!
Here is what I’m been doing

Imports System
Imports System.Windows.Forms
Imports System.Drawing


Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Call newPic(Me)
    End Sub

    Sub newPic(ByVal form As Windows.Forms.Form)
        Dim pic As New System.Windows.Forms.PictureBox
        pic.Location = New Drawing.Point(10, 10)
        pic.Size = New Drawing.Size(40, 25)
        pic.BackColor = Color.AliceBlue
        pic.BorderStyle = BorderStyle.Fixed3D

        Me.Controls.Add(pic)


    End Sub

End Class

The problem is, I have no events control for this pictureBox
I realy wish to have Click and MouseHover events, for each control.

Please help.
Thnanks.
0
bogdem
Asked:
bogdem
1 Solution
 
Bob LearnedCommented:
Example:

AddHandler pic.Click, AddressOf PicClickHandler

Private Sub PicClickHandler(ByVal sender As Object, ByVal e As EventArgs)
End Sub

Bob
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now