How to Dispose/Remove/Clear/Delete Rectangleshape created on Form by button click

Hi Guys,
I have a windows form where there are few textboxses and buttons.
One of the button when clicked creates few rectangles to depict sort of design(its working)
Now my problem is that I want to clear the form for the user to enter again.
I am able to clear textbox but I am not able to remove the rectangles made.
Could anyone suggest how to do it?
I have tried searching for the example but could not find any.
I have not used paint to draw my drawing so any graphic related answer wont work it seems.
I found this but it is giving error :Unable to cast object of type 'System.Windows.Forms.Button' to type 'Microsoft.VisualBasic.PowerPacks.RectangleShape'"
CType(sender, PowerPacks.RectangleShape).Dispose()
what should I do?
Thanks in Advance!
Mak

Hi Guys,
I was able to find out how to remove the all the rectangles which I created
If we just use this
Invalidate()
It will clear the entire surface of the control.
But......
The problem is how to remove specific Rectangles!
Still looking for answers!!, all ideas welcome!
Cheers
Mak
Hello,
You could define that control variable outside that method, and hide them by setting its parent to nothing.
Here is a simple sample.
Imports Microsoft.VisualBasic.PowerPacks
Public Class Form1
Dim canvas As New ShapeContainer
Dim Rect1 As New RectangleShape
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
canvas.Parent = Me
Rect1.Parent = canvas
Rect1.Size = New System.Drawing.Size(140, 140)
Rect1.Location = New System.Drawing.Point(2, 2)
Rect1.BackStyle = BackStyle.Opaque
Rect1.BackColor = Color.White
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
canvas.Parent = Nothing
End Sub
End Class
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How do I remove a child from the stage using a button click?

    I have a movieclip that requires Play, Pause, Forward and Back buttons. The movieclip has actionscript at various frames to load movieclips from the library and repeat them.
    I have tried using a timeline scrubber but it does not trigger the actionscript when scrubbing, only when the movie plays normally.
    My possible solution is to create Fwd and Back buttons that can go to specific frames where key animations will begin.
    I need to develop actionscript that will remove Children when the user clicks Back.
    This is how I am loading several movieclips along the timeline from my library:
    var shpA1:arSHPp1;
    function attachAR1 () {
      shpA1 = new arSHPp1 ();
      shpA1.x = -30;
      shpA1.y = 18;
      addChild (shpA1);
    //the interval is used to repeat the animation to represent continuous flow on a diagram
    var myInterval1:uint = setInterval (attachAR1, 500);
    This what I have tried so far (not working at all - no errors or trace):
    function remChild1(event:MouseEvent) :void {
        if(shpA1.stage)
            trace("arSHPp1 is in display list");
            shpA1.parent.removeChild(shpA1);
            shpA1 = null
        else
            trace("arSHPp1 isn't in display list");

    I did try that but it would not remove the child.
    i appreciate your help though.
    I am also trying to determine if a child is on the stage and if it is, remove it. I have created a button that will jump back on the timeline and the mc's that were loaded after this point in time.
    This looks like it should work. It doesn't give me any errors but the mc remains on the stage.
    var remMC;
    if (getChildByName("mc2") != null) {
      removeChild(mc2);

  • How can I remove and delete songs that are stored in iCloud? I really dislike this feature.

    I really hate this idea of having all of the songs that aren't on your iPhone being out back in there through I cloud. They aren't on my device for a reason. Thanks a lot iTunes.
    How can I remove and delete these songs from my iTunes account in purchased history.

    Transfer to your PC/Mac
    see here
    iOS: Import personal photos and videos from iOS devices to your computer
    Then copy to Flash drive

  • How do I remove or delete a page from a Section?

    How do I remove or delete a page from a Section in Pages?

    The blank page is not blank, there is something on it like a return or word space, or a page break or return on the previous page that forces over to the "blank" page.
    Menu > View > Show Invisibles and delete it.
    Think of a word processing document like a scroll which you view through a set of frames (the pages).
    The scroll is filled from the front and flows through as many pages as necessary to accomodate the text in the main text area between the margins.
    Pages has one quirk however which catches out many users. Floating objects stay on their absolute page, the one where they were placed. If that page no longer exists because the text no longer flows that far, the floating objects are no longer visible. They are still in the document but off the end page, much like objects moved completely off the page to the right or down are still there but not visible.
    So if you want to make sure floating objects are entirely removed from the document delete, or move, those first, then select the text on that page by dragging over it or shift clicking from top to bottom and hit delete.
    Peter

  • How do I remove or delete files within a document folder? I have tried dragging the files to the trash and it does not work

    How do I remove or delete files and image files within a document foler?  I have tried dragging the files to the trash, but that is not working. 

    Right-click (or ctrl-click) on a file. If the "move to Trash" option is greyed out, select "get info" and read the permissions at the bottom of the info window.
    Wat are they?
    Do the same for the enclosing folder - what permissions does that have?

  • How do I remove the security password created after the upgrade?

    How do I remove the security password created after the upgrade?

    you mean passcode?
    settings>general>passcode lock
    and Turn passcode off

  • How do  I remove or delete. A book from Adobe reader

    How duo I remove or delete a book from reader

    Assuming you're talking about a PDF file which you're viewing in Adobe Reader:
    1) Select Documents, and click the Edit button. 2) Click the PDF(s) you want to delete. 3) Click the trash can icon, and confirm the deletion.

  • HT2500 How do I remove the deleted mailbox from the sidebar on Mail?

    How do I remove the deleted mailbox from the sidebar on Mail?  Anyone knows how? Hit delete and dragging to the Trash but none seems to work.

    Hi, try highlighting it the Right click or Control+click & see if Delete Mailbox is an option.

  • How can I remove or delete my posts and resign my membership with Adobe?

    How can I remove or delete my posts and resign my membership with Adobe?

    At the bottom see terms of use you own your content and can ask for its removal but it may remain in the sites backup.  The problem is your responsible to remove it and the way the site code works once an append is made to your's.  Your content becomes locked and you can no longer delete it. IMO part (c) is broken....
    3. Your Content.
    3.1 Ownership. You retain all rights and ownership of your content. We do not claim any ownership rights to your content.
    3.2 Licenses to Your Content in Order to Operate the Services. We require certain licenses from you to your content to operate and enable the Services. When you upload content to the Services, you grant us a non-exclusive, worldwide, royalty-free, sub-licensable, and transferrable license to use, reproduce, publicly display, distribute, modify (so as to better showcase your content, for example), publicly perform, and translate the content as needed in response to user driven actions (such as when you choose to store privately or share your content with others). This license is only for the purpose of operating and improving the Services.
    3.3 Our Access. We will not access, view, or listen to any of your content, except as reasonably necessary to perform the Services. Actions reasonably necessary to perform the Services may include (but are not limited to) (a) responding to support requests; (b) detecting, preventing, or otherwise addressing fraud, security, unlawful, or technical issues; and (c) enforcing these terms.
    3.4 Sharing Your Content.
    (a) Sharing. Some Services may provide features that allow you to Share your content with other users or to make it public. “Share” means to email, post, transmit, upload, or otherwise make available (whether to us or other users) through your use of the Services. Other users may use, copy, modify, or re-share your content in many ways. Please consider carefully what you choose to Share or make public as you are entirely responsible for the content that you Share.
    (b) Level of Access. We do not monitor or control what others do with your content. You are responsible for determining the limitations that are placed on your content and for applying the appropriate level of access to your content. If you do not choose the access level to apply to your content, the system may default to its most permissive setting. It’s your responsibility to let other users know how your content may be shared and adjust the setting related to accessing or sharing of your content.
    (c) Comments. The Services may allow you to comment on content. Comments are not anonymous, and may be viewed by other users. Your comments may be deleted by you, other users, or us.
    3.5 Termination of License. You may revoke this license to your content and terminate our rights at any time by removing your content from the Service. However, some copies of your content may be retained as part of our routine backups.
    3.6 Feedback. You have no obligation to provide us with ideas, suggestions, or proposals (“Feedback”). However, if you submit Feedback to us, then you grant us a non-exclusive, worldwide, royalty-free license that is sub-licensable and transferrable, to use, reproduce, publicly display, distribute, modify, and publicly perform the Feedback.
    3.7 Account Information.
    You are responsible for all activity that occurs via your account. Please notify Customer Support immediately if you become aware of any unauthorized use of your account. You may not (a) Share your account information (except with an authorized account administrator) or (b) use another person’s account. Your account administrator may use your account information to manage your use and access to the Services.

  • How can I remove or delete magazines from newstand app?

    How can I remove or delete magazines from newstand app?

    Thanks Rysz, that took care of it. Appreciate the quick advice..
    Ruben

  • How can I remove or delete the skype names typed o...

    How can I remove or delete  the skype names typed on the sign in box and leave only one skype name?

    Open the Run command/window.
    Type %appdata%\skype into the Run window and click OK.
    Delete the folder named after the Skype Name you wish to remove from the sign-in screen.
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES
    SEE MORE TIPS, TRICKS, TUTORIALS AND UPDATES in
    | skypefordummies.blogspot.com | 

  • How can i remove secure files from the trash? I tried click away the secure notification in info, but still i cann't remove them. Is there a buttoncombination to use?

    How can i remove secure files from the trash? I tried click away the secure notification in info, but still i cann't remove them. Is there a buttoncombination to use?

    If you are unable to empty the trash, try holding the Option key while selecting Empty Trash.
    Otherwise, some steps in the following link may help you.
    http://support.apple.com/kb/ht1526

  • How do you remove a deleted user's cyrus mailbox?

    Hi everyone,
    I am having a little trouble with a user's account on Mac OS X 10.4.8 Server. This is a short description of what has happened.
    1. Created a user in WGM.
    2. User then sends and recieves lots of email over a long period, with no apparent issues and uses the webmail interface as well as pop3 mail application on home PC (as expected!).
    3. User uses webmail one day and discovers a server error in red writing.
    4. Semi intelligent server admin guy (me) decides to delete the user account in WGM and then re-create the user in WGM in the hope of deleting the mailbox in the process.
    5. Semi intelligent server admin guy discovers that the delete/re-create procedure doesnt remove the mailbox so he decides to search apple support forums.
    Hence the reason for this post. Can anybody show me how to delete the mailbox for a user, either in GUI server admin or WGM or even terminal?
    Also I have tried adding the diradmin account to the list of cyrus admins in imapd.conf so that the IMAP application can access all mailboxes but I only get read access, so I cant delete it that way, well unless I skipped a step.
    Thanks in advance,
    Kyran McGlasson

    Yes, I saw that but was a tad puzzled. I see in your help file that you advise creating a new user for imap administration, but (lazy me) I just plugged my server admin into the imapd.conf file and did not create a separate user. My thinking was that the OSX Server mail manual states:
    1 In Server Admin, select Mail in the Computers & Services pane.
    2 Click Settings.
    3 Select the General tab and select Enable IMAP, if it is not already checked.
    4 Select an existing user or create a new user using Workgroup Manger to be an IMAP
    administrator.
    5 If you have not created a user record for the mail administrator’s account, see the user
    management guide.
    6 Open /etc/imapd.conf in a text editor.
    If you are not comfortable using a terminal text editor like emacs or vi, you can use
    TextEdit.
    7 Find the line that reads “admins:”
    8 Edit the line to add the UID number of the administrator account after the colon.
    9 Save your changes.
    10 In your email client application, create an account that uses IMAP to connect to your
    mail service using the mail administrator name.
    For more information, see the man page for imapd.conf.
    And therefore I didn't think a separate user necessary. However, even using their method, I cannot connect to the folders via a client, so I gather you are correct!
    So, I create a separate user, name him "imapadmin" or some such, mod the imapd.conf file accordingly, restart, and then . . . how do I give my new imapadmin the necessary permissions?
    I can, by the bye, delete folders using the direct Cyrus Admin method spelled out on pterobyte's site here:
    http://downloads.topicdesk.com/docs/ProperlyDeleting_OS_X_Server_MailUsers.pdf
    Thanks for the quick reply (on a Saturday!) and for crafting this very cool GUI.
    Lost count   Mac OS X (10.4.9)  

  • How to hide/remove the 'Delete' button for a particular role

    We have a role that can only Create and Edit the Accounts, Contacts, Opportunities, & Leads. So I modified the Default and Owner Access Profiles for that role and changed the Access Level to 'Read/Edit' for each of the above mentioned Record Types.
    When the user is logged with this role they can see the 'Delete' button on all the Record Types. When they click on the 'Delete' button they get the 'Access Denied' message. Thats fine, but how do you hide/remove the 'Delete' button for this role so they don't try to click it.

    At this time it is not possible to hide/remove the "Delete" button. This functionality is on the roadmap.

  • How can I remove a deleted content file from my book's Table of Contents? I

    I deleted the file, saved the book, updated the book, updated the TOC references, and confirmed that the file has been deleted -- but it's still there in the TOC. How can I get it out of there? And at what point in the proceedings should it be gone from the TOC?

    > I deleted the file ....
    How? You need to delete-from-book using the Book menu. A right-click option on the component file name.
    > ... updated the book, ...
    A necessary step, but might not work if the remove isn't done correctly.
    > .... updated the TOC references ...
    What does that mean?
    I would expect a delete-from-book, followed by an update-book, would suffice.

Maybe you are looking for

  • Can I watch a rental movie from my iPad through Airplay on my second generation Apple TV?

    I am trying to watch a movie rental from my ipad through Airplay on my TV. Doesn't seem to be working. Is this possible?

  • 256 color in Forms 10g

    I find that there is support for ONLY 256 color in Forms 10g. Is it a limitation and can we use more than 256 colors? I want to enter r92g136b146 in canvas properties background color. It gives me an errror FRM-12305 Please help. Thanks.

  • Data Flow from TXT to a table error

    Hello, I am trying to fill in the data from a .txt file I have into a table in a DB. Previously this worked fine in DTS and I can still do it when I import the DTS command but I want to update this to a data flow because the DTS commands needs to be

  • Excel add-in 11.1.2.1

    Hi all, We have installed excel addin 11.1.2.1 to connect to essbase server which was reconfigured from native security to use shared services security. When trying to connect wtih admin user it connects and shows the list of applications, but on try

  • Why are the stored site names and adresses randomly mismatching?

    I open Firefox 16.0.2, Windows XP, and find my bookmarks system corrupted. Site names have the wrong addresses attached. i.e there is a random mismatching of bookmarked, names and address. also.. i find i can not delete folders, or content within fol