Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need help here is my code:
Hide   Copy Code
Public Class rotate_image_tutorial
    Private uxLableValue As Object
    Public Property CustomKnobControl1 As Object
    Public Event Load(sender As Object, e As EventArgs)
    Private Sub CustomKnobControl1_ValueChange() Handles CustomKnobControl1.ValueChange
        '-- when the control updates set the value in the label to see it change!
        uxLableValue.Text = String.Format("Value: {0}", CustomKnobControl1.Value)
    End Sub
 
    Private Sub rotate_image_tutorial_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        'CustomKnobControl1.MaxValue = 11
        'CustomKnobControl1.AngleMovement = 15
    End Sub
End Class

but i keep getting bc30506(handles clauses require withevents) i know what to do to fix the error but i don't know where to put it

What I have tried:

i know what to do to fix the error but i don't know where to put it
Posted
Updated 8-Dec-17 4:18am

That's some really strange code. You've got a Handles clause for an event handler inside the control that generates the event? Why would you ever do that?

The Handles clause is what's generating the message. WithEvents and Handles wire up event handlers for you automatically. You can't have Handles clauses on event handlers without the control raising events being declared with "Dim WithEvents myVar As New SomeClass".

But, there's no place to put it in your code. You really even shouldn't have an event handler in that code. You should be overriding the OnLoad method, but you can't even do that because you're not inheriting from any Control class.

There's no real way to fix this code because it's a jumbled, unintelligible mess with no clear purpose.

Also, what's with the Object types?
VB.NET
Private uxLableValue As Object
Public Property CustomKnobControl1 As Object

It seems you don't have a clue what you're doing and have no idea what you should be putting into these variables. You're stumbling around, guessing at, literally, everything.
 
Share this answer
 
Ok i think i solved it thank you i will keep in mind next time i write my code
 
Share this answer
 
Comments
Richard Deeming 8-Dec-17 11:50am    
If you want to reply to a solution, click the "Have a Question or Comment?" button under that solution.

DO NOT post your reply as a new "solution"!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900