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. Make child form label invisible

Make child form label invisible

Scheduled Pinned Locked Moved Visual Basic
helptutorial
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
    d_smit
    wrote on last edited by
    #1

    Hello, I am facing the problem in accessing the child form control property. In my application depend upon certain condition , i have to hide some controls of some child forms. I have created a module wherein writen a Public procedure to hide one of the child form's control and call the procedure in MDI forms load event. But, Whenver i am executing the application , code doen't take any effect and control still remain s visible. Here is the code: Module Mod1 Public sub HideControl(byval var as boolean) if var=false then Dim frmName As frmSearch If frmName Is Nothing Then frmName = New frmSearch frmName.label1.Visible = false End If endif end sub end module This is first way i tried. Second way : I have defined a property for accessing the form instance and with this instance accessing the control as below: ''' global variables Private Shared SearchInstance As frmSearch Private Shared bSearchInit As Boolean Public Shared Property DefInstance() As frmSearch Get If SearchInstance Is Nothing OrElse SearchInstance.IsDisposed Then bSearchInit = True SearchInstance = New frmSearch bSearchInit = False End If DefInstance = SearchInstance End Get Set(ByVal Value As frmSearch) SearchInstance = Value End Set End Property Using this property accessing cotrol and setting its property in module as: frmSearch.DefInstance.label1.Visible = false None of the these codes seems to be working. when i open that child form i still found that label visible. Please anyone who knows the answer let me know, how to do it. Please Give some code , its urgent as i am unable to proceed further. Any help will be highly appreciated. Thanks

    T 1 Reply Last reply
    0
    • D d_smit

      Hello, I am facing the problem in accessing the child form control property. In my application depend upon certain condition , i have to hide some controls of some child forms. I have created a module wherein writen a Public procedure to hide one of the child form's control and call the procedure in MDI forms load event. But, Whenver i am executing the application , code doen't take any effect and control still remain s visible. Here is the code: Module Mod1 Public sub HideControl(byval var as boolean) if var=false then Dim frmName As frmSearch If frmName Is Nothing Then frmName = New frmSearch frmName.label1.Visible = false End If endif end sub end module This is first way i tried. Second way : I have defined a property for accessing the form instance and with this instance accessing the control as below: ''' global variables Private Shared SearchInstance As frmSearch Private Shared bSearchInit As Boolean Public Shared Property DefInstance() As frmSearch Get If SearchInstance Is Nothing OrElse SearchInstance.IsDisposed Then bSearchInit = True SearchInstance = New frmSearch bSearchInit = False End If DefInstance = SearchInstance End Get Set(ByVal Value As frmSearch) SearchInstance = Value End Set End Property Using this property accessing cotrol and setting its property in module as: frmSearch.DefInstance.label1.Visible = false None of the these codes seems to be working. when i open that child form i still found that label visible. Please anyone who knows the answer let me know, how to do it. Please Give some code , its urgent as i am unable to proceed further. Any help will be highly appreciated. Thanks

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      I think you might be making things a bit to complicated. This is how I would do it: in the mdi set a property (shared one) to true or false (for further referance: b1) then when you open the child forms in the contstructor (or load) check this property and set you're controls to visible or not. child.label1.visible= mdi.b1(shared property) ... if you also need to change the visibility of you're child forms while they already exist you can run thru them everytime the property is set: public property b1 as boolean get return ... end get set (value as boolean) for each frm as form in mdi.MdiChildren if frm.gettype.equals(gettype(frmsearch)) then dim f as form = frm f.label1.visible = 'true or false end if next end set hope this helps

      If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.

      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