Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can I Close The Current Form and Open in it again

Posted on 2008-06-20
18
Medium Priority
?
185 Views
Last Modified: 2010-04-23
Can I close the Form , the Open it again automatically
0
Comment
Question by:Ahmadal_najjar2003
[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
  • 8
  • 3
  • 3
  • +3
18 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 21833271
The form, or the whole application?
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 400 total points
ID: 21833286
Hi Ahmadal_najjar2003,

If it's all aplication you can use Application.Restart() or is the form ?
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21833337
Just the Form which I'm Using .
BillMaster.VB
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Ahmadal_najjar2003
ID: 21833371
The Goal is , to refresh all text , Comboboxes ,, so on. As I loaded for first time.
0
 
LVL 18

Expert Comment

by:Priest04
ID: 21833412
Why dont you create some Reset() procedure that will set all controls to default values?

Goran
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21833433
Thats Right , I always do that. But I wish to find another easy way. Otherwise I will use Old way.
0
 
LVL 5

Expert Comment

by:cwickens
ID: 21833567
Try this:
<asp:Button Text="Reset Form" id="btnReset" runat="server" />


In your code behind page write this:

Private Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
Me.Server.Transfer("myPage.aspx")
End Sub
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21833579
Sorry , I'm working with WIndows Application
0
 
LVL 18

Expert Comment

by:Priest04
ID: 21833615
There isnt any other way.

Goran
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 21833708
Other than this:

    Dim bm As New BillMaster
    bm.Show()
    Me.Close()

There isn't any other way to do it...
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 21833774
Even if it's possibl,e is not nice to do it because it takes more time then a refresh (it as to dispose the form and load it) and  it's not nice to the user (that see the flash closing and openning).
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21833837
like this it works

Dim bm As New BillMaster
        Me.Close()
        bm.ShowDialog()

it seems as you open new bill , as manual do.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 21834023
What version VB you using?
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21834040
vb 2008
0
 
LVL 18

Assisted Solution

by:Priest04
Priest04 earned 800 total points
ID: 21834061
If its a modal doalog, then yes, you could do it like that, altough It is not the best way,, since you dont know how many times would you refresh it. So you would need to do something like this


bool refresh = true;

while (refresh)
{
    BillMaster frm = new BillMaster();
    frm.ShowDialog();

    refresh = frm.ReloadForm;
}

Where ReloadForm is the public property of BillMaster, and which you would set to true/false, depending weather you want to reload form after you close it.


But showing form as modal is often not very proffesional, and leaves user with less possibilities, and you should think weather you should make it less professional, in order to make your coding easier.
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 800 total points
ID: 21834216
I assume ShowDialog() is to keep the application from closing?

If so, click on Project --> Properties, then change the "Shutdown Mode" dropdown to "When last form closes".

Then you can it like I showed before:

    Dim bm As New BillMaster
    bm.Show()
    Me.Close()

...and the application will NOT close on you.  =)
0
 

Accepted Solution

by:
Ahmadal_najjar2003 earned 0 total points
ID: 21834301
Really I have 2 great solutions , each with its own case
 
First If my Form will be opend as showdialog , solution of Priest04 is the one
and if my form as show() , Idle_Mind is the one .

Thanks for all .
0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21834535
I also want to thank jpaulino because he give me new info (Application.Restart())

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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