Changing If syntax from VB to C#

  • Thread starter Thread starter Nathan Kovac
  • Start date Start date
N

Nathan Kovac

I searched hard for some advanced c# combobox code and couldn't find any. I
found some examples in vb.net and I am trying to work the new features into
c#. I am having difficulty with converting a few things, I will start with
an If statement.

In vb the line looks like this:
If _showColumns AndAlso (ea.State And
DrawItemState.ComboBoxEdit) <> DrawItemState.ComboBoxEdit Then

in this example:
_showColumns is bool
ea.State is Forms.DrawItemState

What does this vb logic do and how can I accomplish the same thing in c#?

Thanks,
Nathan
 
Nathan,

You would do this:

if (_showColumns && (ea.State & DrawItemState.ComboBoxEdit !=
DrawItemState.ComboBoxEdit))
{
// Do something here.
}

Hope this helps.
 
Back
Top