Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When converting a WPF form, the Handles command in the code behind file is skipped. #1141

Open
mjohansson1 opened this issue Oct 17, 2024 · 2 comments
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@mjohansson1
Copy link

VB.Net input code

    Private Sub TextBoxConnectionString_ValueChanged(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles TextBoxTab3Item.TextChanged, TextBoxTab3Detail.TextChanged
        Changes.Tab3 = True
    End Sub

Erroneous output

        private void TextBoxConnectionString_ValueChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            Changes.Tab3 = true;
        }

Expected output

        private void TextBoxConnectionString_ValueChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            Changes.Tab3 = true;
        }
...
Then, elsewhere in the file:
this.TextBoxTab3Item.TextChanged+= FormEditConfig_Closing;

Details

When converting a WPF form, the Handles command in the code behind file is skipped meaning that no events ever fire.

@mjohansson1 mjohansson1 added the VB -> C# Specific to VB -> C# conversion label Oct 17, 2024
@mjohansson1
Copy link
Author

I checked around and none of the VB->C# converters are doing this. They all just leave it for you to do manually. Manually does not work for me with a million+ lines of code. I just asked ChatGPT to please do this for me and it did. So, workaround is working.

@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Oct 27, 2024

Thanks for the report. There is a whole bunch of code in the converter about dealing with Handles clauses in various different situations. While it'll be hard to perfect the code and I don't have time to take it on right now, you may find that running the converter in debug mode looking at the state around here allows you to tweak things to work for you situation and inform a fuller bugfix:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants