Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equivalent to hwnd in .Net 1

Status
Not open for further replies.

RonRepp

Technical User
Feb 25, 2005
1,031
US
Hi all:

I'm trying to disable the X (close) button of a form. I have used an API for years in VB6, but the code doesn't go over because it calls for the hwnd of the form.

Thanks in advance,


Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Add this in the Declarations section of each form where you want to disable the close button:

Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim CS_NOCLOSE As Integer = Int32.Parse("200", Globalization.NumberStyles.HexNumber)
Dim parms As CreateParams = MyBase.CreateParams
parms.ClassStyle = CS_NOCLOSE
Return parms
End Get
End Property

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thanks.

Works as advertised.

A star for you...or should it be a skull and crossbones?

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top