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

VB -> C#: Comparison of ComboBox.ObjectCollection.Item with integer value #1167

Open
RDH1066 opened this issue Feb 4, 2025 · 0 comments
Open
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@RDH1066
Copy link

RDH1066 commented Feb 4, 2025

VB.Net input code

  For lCount = 0 To cbMWST.Items.Count - 1
                
                If cbMWST.Items(lCount).Item(0) = m_lDefault_MWSTID Then

                    cbMWST.SelectedValue = m_lDefault_MWSTID

                    Exit For
                End If

            Next

... 

Erroneous output

  for (int lCount = 0, loopTo = cbMWST.Items.Count - 1; lCount <= loopTo; lCount++)
                {  
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(((dynamic)cbMWST.Items[lCount]).Item(0), m_lDefault_MWSTID, false)))
                    {
                        cbMWST.SelectedValue = m_lDefault_MWSTID;

                        break;
                    }
                }

Expected output

 for (int lCount = 0, loopTo = cbMWST.Items.Count - 1; lCount <= loopTo; lCount++)
                {
                    if (int.Parse(((ComboBox.ObjectCollection)cbMWST.Items[lCount])[0].ToString()) == m_lDefault_MWSTID)
                    {
                            cbMWST.SelectedValue = m_lDefault_MWSTID;
                             break;
                    }
                }
...

Details

  • Product in use: VS extension / Microsoft Visual Studio Professional 2022 (2) (64-Bit)
  • Version in use: 9.2.6.0 / 17.12.4
@RDH1066 RDH1066 added the VB -> C# Specific to VB -> C# conversion label Feb 4, 2025
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

1 participant