1. Home
  2. Computing & Technology
  3. Visual Basic

VB.NET: What Happened to Control Arrays!!! (Part 5)

By , About.com Guide

3 of 8

The Class code source

~~~~~~~~~~~~~~~~~~~~~~~~~
Public Class PictureBoxClass
  Inherits PictureBox
' used as a ID within the array
  Private I As Integer
' flips the control color
  Private F As Boolean
  Public Event PicBoxClick(ByVal ID)

    Public Property ID() As Integer
    Get
      Return I
    End Get
    Set(ByVal Value As Integer)
      I = Value
    End Set
  End Property

  Public Property FaceUp() As Boolean
    Get
      Return F
    End Get
    Set(ByVal Value As Boolean)
      F = Value
    End Set
  End Property

' To make "Click" and "DoubleClick" act the same way
    Public Sub Picturebox_Click( _
      ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
      Handles MyBase.Click, _
      MyBase.DoubleClick
      RaiseEvent PicBoxClick(ID)
    End Sub
  End Class
~~~~~~~~~~~~~~~~~~~~~~~~~

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. The Class code source

©2009 About.com, a part of The New York Times Company.

All rights reserved.