[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

controls -inheritance

Hi everyone,

In a VB.NET 2005 Windows application.

I have a control MyCbo that Inherits System.Windows.Forms.ComboBox

I have been using this control across the application.

Now I have a procedure that I need to fire whenever the "Leave" event is triggered

The purpose is to add the "Not In list" functionality to the combobox across the application instead of going to every form /combobox and calling the function on the "Leave" event.

Is this possible?
What could be the code to call my NotInlist Function for the "Leave" event?

TIA.

Jorge
0
George
Asked:
George
1 Solution
 
jpaulinoCommented:
You can create a new property and then on leave event you check if the item is in the list and set the property to true or false. something like:
Public Class MyCbo
    Inherits ComboBox
 
    Private m_NotInlist As Boolean
    Public Property NotInlist() As Boolean
        Get
            Return m_NotInlist
        End Get
        Set(ByVal value As Boolean)
            m_NotInlist = value
        End Set
    End Property
 
 
    Private Sub MyCbo_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
        ' You code to check if the item are in the list
        if ... Then
            Me.NotInlist = True
        Else
            Me.NotInlist = False
        End If
    End Sub
 
End Class

Open in new window

0
 
GeorgeAuthor Commented:
Thank you jpaulino!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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