I have a Class that inherits the Button object. I have a simple function and an event handler for Click. When I put this on another Window Form - works perfect! However, I now want to be able to disable the user from selecting the 'Click' event when it is being used. Hopefully this makes sense.
As an attempt to clarify: I have a cusom button but I don't want the user to be able to program the Click event when putting it on a form.
I'm getting tired of putting this but... I'm obviously new to .NET
EDIT: Here is the code
Public NotInheritable Class clsRandomGenerator
Inherits Button
Protected Const ALPHA_UPPERCASE As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Protected Const ALPHA_LOWERCASE As String = "abcdefghijklmnopqrstuvwxyz"
Protected Const NUMERIC As String = "0123456789"
Protected Const SPECIAL_CHAR As String = "!@#$%^&*"
Protected Const ALPHA_NUMERIC As String = ALPHA_UPPERCASE & ALPHA_LOWERCASE & NUMERIC & SPECIAL_CHAR
Public Shared Function GetRandomPassword() As String
Dim RandomData As String = String.Empty
Dim intPosition As Integer = 0
Dim intLength As Integer = 8
Dim data As Byte() = New Byte(intLength) {}
Dim charSetLength As Integer = ALPHA_NUMERIC.Length
Dim randomize As RandomNumberGenerator = RandomNumberGenerator.Create()
randomize.GetBytes(data)
For index As Integer = 0 To intLength - 1
intPosition = data(index)
intPosition = intPosition Mod charSetLength
RandomData = (RandomData + ALPHA_NUMERIC.Substring(intPosition, 1))
Next
Return RandomData
End Function
Private Sub clsRandomGenerator_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
MessageBox.Show(GetRandomPassword)
End Sub