Equivalent operators and expression for &=, ~, |= in VB.NET

975 views Asked by At

I need to convert the following lines of code in VB.NET but confused with the operators, can someone describe the name of these operators and their equivalent in VB:

long style= GetWindowLong(hWnd, GWL_STYLE);
style &= ~(WS_VISIBLE);    // this works - window become invisible 

style |= WS_EX_TOOLWINDOW;   // flags don't work - windows remains in taskbar
style &= ~(WS_EX_APPWINDOW); 
1

There are 1 answers

0
Dave Doknjas On

Since VB uses keywords for bitwise operators, it doesn't offer a shorthand self-assignment operator. You have to use: X = X And Y and X = X Or Y

Also, the equivalent to '~' is 'Not' (same keyword as logical 'Not', but different behaviour).