Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created the windows form and disabled the frmborderstyle property to NONE.

now i have created the close button to close the page and i wrote the following code.

forms.remove("MyPage")

But it is giving the system.argument.exeception as argument(key) is not valid.

What I have tried:

forms.remove("MyPage")
Posted
Updated 12-Jun-17 22:49pm
Comments
Richard MacCutchan 13-Jun-17 3:59am    
What is forms and what parameters are expected by the remove method?
Member 13142345 13-Jun-17 4:46am    
forms is visual basic collection of forms.
Remove Removes an element from the collection of objects and it takes key as string
Member 13142345 13-Jun-17 4:46am    
can you suggest me the better way to do it.
Richard MacCutchan 13-Jun-17 4:50am    
See my solution below.

If you look at Control.ControlCollection Class (System.Windows.Forms)[^] you will see that the Remove method accepts only a control reference or an integer.
 
Share this answer
 
I didn't understand your question. But I use the simple method below to close my windows form.
VB
me.close()
 
Share this answer
 
Comments
Member 13142345 13-Jun-17 4:49am    
Simple and Superb.:)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900