Make all controls inside a Groupbox or Panel unusable without disabling them

Hello !
I'm using Vb.net 2013 , NET 4.0.
I'm trying to make all the controls inside a Groupbox ( or Panel) , unusable by users if a condition is true.
This is the code that I'm using :
Class NW
Inherits NativeWindow
Public Sub New(hwnd As IntPtr)
AssignHandle(hwnd)
End Sub
Const WM_NCHITTEST As Integer = &H84
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_NCHITTEST Then
Return
End If
MyBase.WndProc(m)
End Sub
End Class
Dim nwss As List(Of NW) = Nothing
Public Sub block_area(flag As Boolean)
If flag = True AndAlso IsNothing(nwss) Then
nwss = New List(Of NW)()
For Each c As Control In GroupBox1.Controls
nwss.Add(New NW(c.Handle))
Next
Else
If flag = False And (Not IsNothing(nwss)) Then
For Each nw As Object In nwss
nw.ReleaseHandle()
Next
nwss = Nothing
End If
End If
End Sub
The problem is that this code works for all controls , except the TextBox and DateTimePicker . These 2 controls remain always clickable and editable so usable by users.
 What can I do ?
Thank you !

Ok , friend , if you don't like this question , you can close it anytime. Next time when I need to make a question , I will be careful to do more hard questions like : " What will be the final result of a=1  a=a+1" . This is pure VB.net ,
I think.
I'm sorry if it upsets you that your code will not work as intended. Everyone here is just trying to help you understand that there is no good solution to your problem from a managed code perspective in Windows Forms. The best answers are to use a different
presentation system or to spin your own custom control at the Win32 level (or buy one from someone else who has already done all of that work). The next bester answer is to fudge it with an image that you capture and update as appropriate.
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
ok , can you only give me a simple answer : What is the WM code that has to do with pressing keys from keyboards in a control ? I try to modify my code if you help me with this. Thank you !
Hello Friend Here is my sample - very elementary, please make more good:
Public Class clsControl
Inherits Control
Public actualControl As Control
Private Property hiddenLock As Boolean = False
Public Property lock As Boolean
Get
Return hiddenLock
End Get
Set(value As Boolean)
If value Then
Dim _bmp As New Bitmap(actualControl.Width, actualControl.Height)
actualControl.DrawToBitmap(_bmp, actualControl.ClientRectangle)
actualControl.Enabled = False
actualControl.Visible = False Me.BackgroundImage = _bmp
Me.Controls.Remove(actualControl)
Else
actualControl.Enabled = True
actualControl.Visible = True
Me.Controls.Add(actualControl)
Me.BackgroundImage = Nothing
End If
hiddenLock = value
End Set
End Property
Public Sub New(ByRef _control As Control)
actualControl = _control
Me.Controls.Add(actualControl)
actualControl.Location = New Point(0, 0)
actualControl.Visible = True
End Sub
End Class
'FORM1 CODE
Private _c As clsControl
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim _txt As New TextBox
_txt.Size = New Size(100, 20)
_txt.Visible = True
_c = New clsControl(CType(_txt, Control))
Me.Controls.Add(_c)
_c.Size = _txt.Size
_c.Visible = True
End Sub
Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
_c.lock = Not _c.lock
End Sub
Enjoy friend I spent time to make it work.

Similar Messages

  • HT4527 i just copied some music from my external hard disc to my macbook . how can i make all that music be shown in my iTunes without having double copies of the music??

    i just copied some music from my external hard disc to my macbook . how can i make all that music be shown in my iTunes without having double copies of the music??

    Hello Sudhanshu Mishra,
    Thank you for using Apple Support Communities!
    You can have iTunes reference the content where ever it is on your HDD without copying the content to the iTunes library, thus using twice the space.
    If iTunes is set to "Copy files to the iTunes Music folder when adding to library," iTunes will copy all content that is added to the iTunes library to the iTunes Music folder. To adjust this setting or change the location of this folder, go to the Advanced tab in iTunes Preferences.
    From: Adding music and other content to iTunes
              http://support.apple.com/kb/HT1473
    Additionally if you want the content to then ALSO be located in your iTunes Library folder so everything is all kept together nice and tidy, use this:
    Consolidate your files in the iTunes folder
    Depending on how you imported items into iTunes, some items in your library might be stored in different locations (in another folder or on another hard disk, for example).
    You can consolidate all the files in your library in the iTunes folder—for example, to make it easier to move your library to a new computer.
    Choose File > Library > Organize Library.
    Select “Consolidate files.”Files remain in their original locations, and copies are placed in the iTunes folder.
    To create folders (Music, Movies, TV Shows, Podcasts, Audiobooks, and so on) inside your iTunes folder, and place all your imported media files in the appropriate folders, select “Reorganize files in the folder ‘iTunes Media.’”
    From: help://bookmark='https://help.apple.com/itunes/mac/11.0/help/index.html?localePath=English.lproj# itns2999'
    Cheers,
    Sterling

  • How can I delete all photographs in stream of my iPhone 4 without loosing them on my mac?

    How can I delete all photographs in stream of my iPhone 4 without loosing them on my mac? Because I have too much photographs
    in my phone's memory and I need to know a simple methode to get them off.

    Login to iCloud.com, hit the "Reset Photo Stream" button. This will delete all photos stored in iCloud, but not any photos pushed to any devices. Then, on your phone, Settings>iCloud>Photo Stream>Off. This will delete all photos in your Photo Stream album, on your phone. This will leave them on your Mac as long as you don't turn Photo Stream off on your Mac. If you first import them to your iPhoto library, you can then turn Photo Stream off on your Mac & they will remain in your iPhoto library.

  • How can I make a control inside a loop in a subVI change value when the calling VI's control changes?

    Hi.
    I think this is a pretty basic LV question, but I have not been able to find a good solution.
    I am attaching VIs that show the problem I am having, but obviously, the real application is a lot complicated, which forces me to try to do it this way.
    The issue is: I have a subVI with a Boolean control inside a loop.  When the control is true I want some action to take place.  When the subVI is run on its own, it works fine, acting properly when I set the boolean control to true via the LV FPGA interface from the host.  However, when I use it as a subVI, in which the top-level VI calls several instances of the subVI, I have the Boolean controls in the top level VI.  What is happening is that the false Boolean value with which the top-level VI starts is passed into the subVIs, and not updated, even though the control is inside the loop.
    Can any one suggest a good solution?
    Thanks,
    AlejandroZ
    Attachments:
    CallingVI.vi ‏7 KB
    subVI.vi ‏8 KB

    Hi.
    I know the example I posted might seem silly, but it was just to illustrate the problem I am having.  In reality this is the application:
    I have some LV FPGA code which uses a few FPGA IO to implement a serial link to communicate with a device.  Most of the time we are getting data from the device, so the serial link is used to send a read command, read in the data and put it into a FIFO.  However, I also wanted the VI to support sending data to the device, so I added an array control to put the data you want to send, and a boolean control to tell it you want to send it.
    Since sending and receiving data are done using the same FPGA IO, they cannot be independent operations, because they would garble each other. Therefore, in the subVI I have a loop in which I first read data if there is any to read, then check the boolean write control to see if there is data to write.
    As I mentioned, this works perfectly for talking to a single device.  However, we run into the issue of this topic when trying to replicate this for several devices.
    One easy solution is to not have the loop in the subVI, and have it in the calling VI (I am favoring this simple solution right now).  The only reason why I have not done this yet, is that the subVI has more than one loop, so I am going to have to create several subVIs.  I just posted to see if there was an even simpler solution...
    There have been some other possibly good solutions proposed here, though I am not sure if they work in LV FPGA.
    Thanks for all your responses.
    AlejandroZ

  • Default font of TitledBorder makes all text inside it bold.

    Hi!
    I try to set a border with a title - the format of which will be default, and size and color will be defined by me.
    I use the following:
    Border myBorder = BorderFactory.createTitledBorder(
    BorderFactory.createLineBorder(Color.black), "My Title",TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION,new Font("null",Font.PLAIN,40),Color.black);
    mainPanel.setBorder(myBorder);
    After that, all the text in mainPanel(including JButtons and JLabels) changes(becomes bold).
    What can I do to prevent this? How can I make my border text not change all the other text?

    Hey nemaria,
    I would suggest extending the TitledBorder and overriding the getTitledFont method to return a font that is not bold.
    -- Bud

  • How can i make lightroom 3 import photos as filtered in camera without changing them to color?

    I am a film photographer, recently acquired digital camera (Canpn 5 D Mark II) for the first time.  I shot in monochrome+sepia+green filter but when I import in LR it switches all the photos to colour.  How can I stop the monster?  Thanks.

    Actually, you can, but at a cost.
    You could use Canon's DPP to convert your raw files to tiff or jpeg and import those to Lightroom. Or you could shoot in jpeg rather than raw and import the jpegs into LR. The first is a hassle, and both will likely cost you some quality.
    Personally, when I want a monochome image, I go to the HSL/Color/B&W panel in the Develop module, choose B&W, and adjust the sliders to give me the image I want.
    Hal

  • How do you delete all occurrences of a recurring event in iCal without deleting them one by one?

    These events have no stopping point, and go on into eternity. How do I get them out of iCal without having to delete each one separately? I want to sync with my new iPhone, but don't want these events in my iPhone calendar. They are in my old iPhone when I synced it a couple of years ago. In the iPhone, you have no way to delete or edit these events.
    Thanks for any suggestions.

    pedfogog,
    ... or whoever may find this post in need of assistance as I was.
    I just had this same problem and successfully deleted ALL event (past and future)instances by :
    1. Click on any instance of the event in the calendar
    2. Select "Delete" from the iCal toolbar "Edit" menu.
    3. The iCal propmt asked me to choose to delete all or just the one instance.
    4. Naturally, select to "Delete all occurrences"
    I am running OS 10.6.8   iCal 4.0.4

  • How to make appear all controls?

    in examples, some controls appears
    how to make these control appear in a new project?
    i'm looking for data i/o controls
    thanks

    Not sure what the problem is...if you see a control in one of the examples that you want in another VI just copy and paste. If you want to make a front panel template just create a VI template (option in the new...dialog) and paste and arrange the controls on the front panel of that...
    If there is code in the example that hides the control and you wonder how to make it appear again just go to the diagram, locate the terminal of the control, right-click on it and select show...
    If the problem is how to make all controls on a panel appear (if e.g. there are 100 controls hidden and you want to un-hide them all)...open a reference to the front panel of the VI, get a reference to all the controls using the get control refs property and then wire the array of references
    to an auto-indexed for-loop where you wire the references to a "visible" property and set the property to true...run it and all the controls will reappear.
    MTO

  • How to count all files inside a disk?

    Hi,
    is there any free app to count all files inside a hard disk or volume without open all volumes and folders?
    Not the size, but the number of files.
    Thank you very much.

    Disk Utility displays a full drive folders and files
    Finder with Show Status Bar, displays folder items at the bottom the Finder window
    Do you require further information than these?

  • How can I make a global change so all controls and indicators labels on the front panel change to another colour?

    How can I make a global change so all controls and indicators labels on the front panel change to another colour?
    I need to change the front panel so that it can be used in a dark environment.

    Hi
    The only way I see, is to use the "Controls[]" property and iterate through all of them. But don't forget about nested elements (i.e. clusters, tab-controls, ...).
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How can I get a reference to all controls on a front panel of one type )for example of the type Text Ring?

    I'd like to set the strings[] property of all the Text Ring controls on a front panel at once without creating a property node for every text ring. How can i do that?

    > How can I get a reference to all controls on a front panel of one type
    > )for example of the type Text Ring?
    >
    > I'd like to set the strings[] property of all the Text Ring controls
    > on a front panel at once without creating a property node for every
    > text ring. How can i do that?
    This is likely more complicated than making property nodes for each
    ring, but you can do it. Make a subVI that takes in a panel reference,
    reads the array of control references, loops through them looking for
    rings, and modifying the Strings[] property on each ring.
    The part of this that will probably be the least obvious, when you
    have an array of control references there are two ways to find out
    if an element is a ring. You can read the classID and compare it
    to the cla
    ssID of a true ring control. An alternative is to cast
    the control reference to a ring control using a Cast to more specific
    node and wire the error out to a case structure. The error case is
    where the objects that aren't rings will go. The success case case
    where you will have a valid ring refnum that you can use to modify
    the strings.
    Greg McKaskle

  • TABbing between controls inside a panel to controls outside a Panel

    Hi,
    I have a C# winform with few controls inside a Panel control and few outside it.The TABbing order traverse from controls inside a panel to controls outside a panel.
    Do we have any way to accomplish this.
    Thanks,
    sami

    If you set the TabIndex of the Panel control itself to for example 77, the outside control with TabIndex 78 will be focused when you tab out from the control within the Panel with the highest TabIndex. Also make sure that you set the Tabstop property
    of the Panel to true.
    So basically the controls inside the Panel have their own TabIndex series (starting from 0) and the Panel itself is part of the Form's (or parent control's) TabIndex series.
    It is just a matter of setting the values of the TabIndex properties correctly (and setting the Tabstop property to true for the Panel control).
    The other option is to replace the Panel with a UserControl.
    Please remember to close your threads by marking helpful as answer and then start a new thread if you have a new question.

  • Can I have an array of controls without having them in the array front panel holder?

    I would like to link a number of boolean control buttons in an array without grouping them on the front panel the way it does when you make an array and then put in a boolean control.
    Here's the background:
    I have 8 linear motors controlled by CANbus, and so each button type (Move, Stop, Home, etc) is duplicated 8 fold.  I have an event structure that is currently triggered with a separate case for EVERY button with only a very small difference in the code inside each case.  Ideally I could have the buttons in arrays and then check the new array value against the old value on a value change event.  The alternative for me is to have each case handle the 8 buttons (with a Mouse Down? filter event) and then use the Boolean.Text value from the CtlRef and search an array of all Boolean.Text Values for the 8 buttons to see which name matches and process accordingly.  I have something like 200 buttons, so making the arrays of Boolean.Text values from the reference nodes is WAY too time consuming as I have to go through like 5 levels of right click menus.  Any suggestions?  

    Mark,
    You might consider using clusters on the front panel.  Create a type def'd cluster that has all the boolean controls for 1 channel.  You can drop 8 of these on the front panel and the event structure can detect a change in a cluster.  Easy to convert cluster to array behind the scenes.  Remember that order of cluster determines index of value in array.
    Message Edited by Wayne.C on 04-09-2010 05:19 PM

  • Property node of a control inside of cluster inside an array

    I've created a control that has a cluster made of a Boolean, a String and a Numeric.  Then in my front panel I've created an array of these custom controls.  I would like to have access to the property of the controls inside of the cluster within the array.  ie, I want to change the color of the Boolean or make it blink, or "disable and gray" the text box.  I think I'm on the right track, or maybe I'm on the wrong path.  I've attached and example VI (testtray.vi) and the control that I'm using (UUT_Display.ctl).  Please excuse the use of a Flat Sequence Structure, I know it's poor programming practices, but I just wanted to throw something together.
    Any help would be appreciated.
    kevin
    Solved!
    Go to Solution.
    Attachments:
    testTray.vi ‏19 KB
    UUT_Display.ctl ‏5 KB

    I have enclosed a quick and dirty example of replicating the blinking in an array of clusters.  You can turn it on and off, but as we have noted, only for all of the elements.  If you were only showing one element of the array you could change properties based on which element was displayed.  You probably want to see them all.  In that case, you could use a cluster of clusters.  This may be a pain, but I would suggest that you use an array of clusters to do your manipulations.  Use Array->Cluster to convert to a cluster for display purposes.  Then you can manipulate the properties of the cluster.
    My guess is easier said than done, good luck.
    Attachments:
    Blink182.vi ‏98 KB

  • Show hidden control inside editor

    Hi,
    i have following question! I created a user control inside the editor.
    It contains a cluster with several controls inside. Each control i can
    hide or show. But how can i get back the visibility of the cluster
    after i hide it? I didn't found an entry in the menu or anything else...
    Could somebody give me a tip?
    Thnx
    Henrik

    > sorry, i think that i explained it not enough.
    > What i want to have is a custom control which will show a bitmap when i
    > insert it into a vi. Cause the custom control is a cluster with 17
    > controls inside, i wanted to hide all controls and the cluster and show
    > a bitmap instead. The main reason is to hide the flowing data and to
    > reduce the size of the painted element in all this control using vi's.
    > The work i have to do in the custom control editor and there is no
    > diagram avaible. Later perhaps i have to make changes to the
    > cluster...how could i make it visible to change the data?
    >
    I'm afraid I'm still not sure what is being asked. Here is
    my guess. You want to use a strict typedef of a cluster of
    17 items. The typedef takes too mu
    ch room on your subVI
    panels. I'd recommend shrinking the cluster to clip out
    the items. This isn't a good idea in general because you
    can't see the items, but this seems to be what you are
    looking for. Make the cluster be about the size of a
    postage stamp and place a graphic or a comment label
    inside of it.
    When you are ready to show the items again, open the
    typedef and grow the cluster again.
    If the reason for shrinking the cluster is to minimize
    the memory impact, keep in mind that the panels that
    contain the controls are not kept in memory on most subVIs,
    and in fact, they aren't even compiled into a built executable.
    Greg McKaskle

Maybe you are looking for

  • Aggregates on Technical Content

    Hi Guru's, I have installed the Technical Content Cube ( 0BWTC_C05) ,which is for ware house performance monitoring, Now I have to create a process chain to load data into this Infocube. As we are not using the Multiprovider,we cant have the standard

  • LG MKJ-4065-3801 LCD TV remote programming instructions.

    Need instructions on how to program the remote for LG MKJ-4065-3801 LCD TV.  Need to program it to control Toshiba DVD player. Don't find any instructions or codes in the owner's manual or on the LG support site.

  • BUG: Business Components using Datasources on Websphere - statement closed

    Hi, This is an unusual combinatation, we are deploying business components projects on websphere with a SQL Server database. This was originally deployed all to Oracle. We have managed to convert the project sucessfully (JDeveloper 10.1.3) and on Web

  • What is OBEXAgent and why is it turning my MacBook into a furnace?

    Hey guys, first post here so bear with me Lately my MacBook Pro (2.53 GHz Intel Core 2 Duo) has ben running reeeaally hot. I can't even touch it on the bottom or behind the keyboard. Going to investigate, I went into my Actvity Monitor and OBEXAgent

  • I want to maintain  payment terms...material wise

    hi, Experts, here i want to maintain vendorwise and material wise payment terms....Vendorwise payment terms its ok i got it but how to maintain paymet terms for material.....is there any way to do maintain material wise payment term... thaks in advan