Resolved Converting a VB.Net Control into a C# Control

tim8w

Well-known member
Joined
Sep 8, 2020
Messages
133
Programming Experience
10+
Hi,
I have this VB.Net Control that I has used in a couple of old projects and would like to use it in my current C#.Net project. I got it all converted and running except for one function. It has a Timer that runs to make it flash. In VB.Net it calls the Timer_Tick in C# it does not. I suspect it has something to do with the Friend WithEvents being converted to private in C#, but I'm not sure.

VB.Net:
Friend WithEvents tmrFlashing As System.Windows.Forms.Timer

C#.Net:
private System.Windows.Forms.Timer tmrFlashing;

Any ideas? Do I need to post more code?
 
Solution
Hi,
I have this VB.Net Control that I has used in a couple of old projects and would like to use it in my current C#.Net project. I got it all converted and running except for one function. It has a Timer that runs to make it flash. In VB.Net it calls the Timer_Tick in C# it does not. I suspect it has something to do with the Friend WithEvents being converted to private in C#, but I'm not sure.

VB.Net:
Friend WithEvents tmrFlashing As System.Windows.Forms.Timer

C#.Net:
private System.Windows.Forms.Timer tmrFlashing;

Any ideas? Do I need to post more code?
Forgot to include the Event in the Designer...

this.tmrFlashing.Tick += new System.EventHandler(this.tmrFlashing_Tick);
Hi,
I have this VB.Net Control that I has used in a couple of old projects and would like to use it in my current C#.Net project. I got it all converted and running except for one function. It has a Timer that runs to make it flash. In VB.Net it calls the Timer_Tick in C# it does not. I suspect it has something to do with the Friend WithEvents being converted to private in C#, but I'm not sure.

VB.Net:
Friend WithEvents tmrFlashing As System.Windows.Forms.Timer

C#.Net:
private System.Windows.Forms.Timer tmrFlashing;

Any ideas? Do I need to post more code?
Forgot to include the Event in the Designer...

this.tmrFlashing.Tick += new System.EventHandler(this.tmrFlashing_Tick);
 
Solution
I have this VB.Net Control that I has used in a couple of old projects and would like to use it in my current C#.Net project.
And you could still have used it. VB.NET compiles down to the same IL that C# and F# compile into.
 
Back
Top Bottom