Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. disable close and starting maximized?

disable close and starting maximized?

Scheduled Pinned Locked Moved Visual Basic
questioncsharphelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drmzunlimited
    wrote on last edited by
    #1

    if there is a form in Vb.net then how to disable the close button in that. and there is one form1 which is starting form of my application and I want to start it maximized . how do I do that ? plz help thnx aakash

    G 1 Reply Last reply
    0
    • D drmzunlimited

      if there is a form in Vb.net then how to disable the close button in that. and there is one form1 which is starting form of my application and I want to start it maximized . how do I do that ? plz help thnx aakash

      G Offline
      G Offline
      goddess_spanky
      wrote on last edited by
      #2

      To disable the close button in a form, add this module to your project... Option Explicit Option Private Module Public Declare Function GetSystemMenu Lib "user32" _ (ByVal hwnd As Long, _ ByVal bRevert As Long) As Long Public Declare Function RemoveMenu Lib "user32" _ (ByVal hMenu As Long, _ ByVal nPosition As Long, _ ByVal wFlags As Long) As Long Public Const MF_BYPOSITION = &H400& Public Function DisableCloseButton(frm As Form) As Boolean Dim lHndSysMenu As Long Dim lAns1 As Long, lAns2 As Long lHndSysMenu = GetSystemMenu(frm.hwnd, 0) '//remove close button lAns1 = RemoveMenu(lHndSysMenu, 6, MF_BYPOSITION) '//Remove seperator bar lAns2 = RemoveMenu(lHndSysMenu, 5, MF_BYPOSITION) '//Return True if both calls were successful DisableCloseButton = (lAns1 <> 0 And lAns2 <> 0) End Function Then in the form_load() event, add this Private Sub Form_Load() Dim retval as boolean retval = DisableCloseButton(frmName) End Sub as for starting the form maximized, there should be a property window for the form with an option labeled "WindowState", just set that to "2-Maximized" or add this to the form_load() event as well frmName.WindowState = 2

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups