Click here to Skip to main content
12,508,491 members (54,901 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
Hello, i have problem in vb.net like as below.
i want to disable Close Button[X]of MDI in vb.net.
i don't want to set controlbox property.
otherwise it will not showing icon.
Posted 26-Mar-12 0:54am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It's in C#, but it's pretty short and should be easy to convert (try DeveloperFusion - they have an online translator):
Disable the Close box on a form[^]
  Permalink  
Comments
Dipak V Nakum 26-Mar-12 6:59am
   
i had written in the question i don't want to set controlbox property.
otherwise it will not showing icon that's why any other way to do this.
OriginalGriff 26-Mar-12 7:10am
   
Did you read the link, at all? It doesn't set the ControlBox property - or even mention it except to say that it causes problems...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

You just need to put this code into your form code behind
Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim param As CreateParams = MyBase.CreateParams
        param.ClassStyle = param.ClassStyle Or &H200
        Return param
    End Get
End Property
and that will disable the (x) close button.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Hi,
Following is the code-
Private Const CP_NOCLOSE_BUTTON As Integer = &H200
Protected Overloads Overrides ReadOnly Property CreateParams() As    CreateParams
   Get
      Dim myCp As CreateParams = MyBase.CreateParams
      myCp.ClassStyle = myCp.ClassStyle Or CP_NOCLOSE_BUTTON
      Return myCp
   End Get
End Property
  Permalink  
Comments
Member 10218151 18-Dec-13 3:35am
   
Its Very usefull

interesting how does it works.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 7

set controlbox property to false
  Permalink  
Comments
CHill60 23-Feb-14 15:19pm
   
See Solution 1 from 2 years ago and the OP's question
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

Use the image button and set the property Onclinetclick=javaScript:window.close(); return false;
  Permalink  
v2
Comments
CHill60 12-Jun-13 7:21am
   
If you have additional information for your post use the "Improve question" link, don't post a "solution" to your own question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160927.1 | Last Updated 20 Feb 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100