Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I want to convert these two method into C# but I don't know how to keep the event handles to keep these two method working in C#.

VB.NET Code:

VB
Private Sub SetLAO(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCL_VL_LA.Enter, txtCL_FN_LA.Enter, txtCL_LN_LA.Enter
        vhd.SetLao(2)
    End Sub

    Private Sub SetENG(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCL_VL_LA.Leave, txtCL_FN_LA.Leave, txtCL_LN_LA.Leave
        vhd.SetLao(0)
    End Sub



I tried to convert like this:

C#
private void SetLAO(System.Object sender, System.EventArgs e)
        {
            vhd.SetLao(2);
        }

        private void SetENG(System.Object sender, System.EventArgs e)
        {
            vhd.SetLao(0);
        }


but it seem no event handles for each textbox
So please help!

Thank you in advance
Posted

1 solution

In InitializeComponent() method (in .designer.cs file), add:
C#
txtCL_VL_LA.Enter += SetLAO;
txtCL_FN_LA.Enter += SetLAO;
txtCL_LN_LA.Enter += SetLAO;
txtCL_VL_LA.Leave += SetENG;
txtCL_FN_LA.Leave += SetENG;
txtCL_LN_LA.Leave += SetENG;

You may have to be careful as to where you put these lines in the code file. Observe the structure of this file and decide where to put each line.
 
Share this answer
 

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