Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What to do with a windows form after the data has been saved in vb.net

Posted on 2014-02-21
5
Medium Priority
?
216 Views
Last Modified: 2014-02-21
Hi all.

I just finished a windows form in Visual Studio 2010 and now I'm wondering how can I clear everything and open the form again.

After the data is saved I'm going to ask them "Do you want to submit another item?". If they say no then I'll close the form, but if they say yes then how can I reopen the form to it's initial state.

Thank you in advance.
0
Comment
Question by:printmedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39877134
If you just have a bunch of textboxes then you can:
for each c as control on me.controls 
  if typeof(c) is texbox then
    directcast(c, textbox).clear
  end if
next

Open in new window

0
 

Author Comment

by:printmedia
ID: 39877151
Thanks! I also have 2 datagridview controls that have data based on what is entered in some of the text boxes. How do I clear the datagrids?
0
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39877155
I'd put this in a "Initialize" subroutine (call it whatever you want) and call that when loading the form...then later you can just call that subroutine whenever you need to clear the form.
0
 
LVL 15

Accepted Solution

by:
David L. Hansen earned 2000 total points
ID: 39877163
directcast(c, datagridview).rows.clear

OR

if you are using the datasource property of the grid, just set the datasource = nothing
0
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39877359
Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question