Click here to Skip to main content
15,911,715 members

Comments by Vince McElwee (Top 2 by date)

Vince McElwee 29-Jul-21 20:01pm View    
I wish to thank you for your patience and
quick responses. You seem to be very knowledgeable
in helping me with this obstacle of mine.

It seems all my documentation research uses C# as
examples instead of VB .NET WPF. This makes it
difficult for me to translate it into the VB code.

Yes, the Form.ControlBox = False VB statement is written
on a single line of code in isolation. I have no idea what "Form"
needs to be replaced with and its value.

No, I did not replace the class name "Form" with a actual instance
variable name, or with "this". The documentation says the "this"
keyword refers to the current instance of the class. I experimented
with the following VB statements:

VB Code Test #1...
this.ControlBox = False

"this" is flagged the same as "form" by Visual Studio with...

BC30188: Declaration Expected.

VB Code Test #2..
Dim hwnd As IntPtr = New System.Windows.Interop.WindowInteropHelper(this).Handle

and "this" is flagged by Visual Studio with...

BC30451: 'this' as not declared. It may be inaccessible due to its
protection level.

If you can use your expertise on what I'm failing to do, it would be
appreciated.

Perhaps you can write some VB .NET WPF code to prove results
to remove the form Close (X) button.

During my research I found the following article (again it is using C#):

How to hide close button in WPF window?
https://stackoverflow.com/questions/743906/how-to-hide-close-button-in-wpf-window

I know your time must be valuable, I can only express my sincere Thanks.
Vince McElwee 28-Jul-21 21:55pm View    
The "Disable the Close box on a form" quickest solution using...
Form.ControlBox = False
however my Visual Studio Visual Basic WPF flagged "Form" with a
error message...
BC30188: Declaration Expected.
Can you explain and help to correct?
Thanks.