Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog
Freezing after Save File Dialog Freezing after Save File Dialog
Freezing after Save File Dialog
Go Back  Xtreme Visual Basic Talk > > > Freezing after Save File Dialog


Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2012, 12:27 AM
KrisDwyer's Avatar
KrisDwyer KrisDwyer is offline
Newcomer
 
Join Date: Jun 2008
Posts: 20
Default Freezing after Save File Dialog


Hey guys.

After the Save File does it's business, I cannot click any other buttons in the form - effectively locking up the program.

What could be causing the problem?

Quote:
'This call is required by the Windows Form Designer.
InitializeComponent()

Dim dir, dir2 As String
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments )
dir2 = dir + "\FootyCoach\Saved Lineups"

If Not Directory.Exists(dir2) Then
Directory.CreateDirectory(dir2)
End If


sfd = New SaveFileDialog
sfd.Filter = "footy coach tactics files (*.fct)|*.fct"
sfd.InitialDirectory = dir2

If sfd.ShowDialog() = DialogResult.OK Then
chicken = sfd.OpenFile()



Using writer As New StreamWriter(chicken)
writer.WriteLine(SystemVar(1, 201))
writer.WriteLine(SystemVar(1, 202))
writer.WriteLine(SystemVar(1, 209))
writer.WriteLine(SystemVar(1, 216))
writer.WriteLine(SystemVar(1, 223))
writer.WriteLine(SystemVar(1, 210))
writer.WriteLine(SystemVar(1, 217))
writer.WriteLine(SystemVar(1, 224))
writer.WriteLine(SystemVar(1, 218))
writer.WriteLine(SystemVar(1, 251))
writer.WriteLine(SystemVar(1, 252))
writer.WriteLine(SystemVar(1, 211))
writer.WriteLine(SystemVar(1, 250))
writer.WriteLine(SystemVar(1, 225))
writer.WriteLine(SystemVar(1, 212))
writer.WriteLine(SystemVar(1, 219))
writer.WriteLine(SystemVar(1, 226))
writer.WriteLine(SystemVar(1, 213))
writer.WriteLine(SystemVar(1, 220))
writer.WriteLine(SystemVar(1, 227))
writer.WriteLine(SystemVar(1, 253))
writer.WriteLine(SystemVar(1, 254))
writer.WriteLine(SystemVar(1, 255))
writer.WriteLine(SystemVar(1, 256))
writer.Close()
End Using
Reply With Quote
  #2  
Old 07-25-2012, 12:53 AM
KrisDwyer's Avatar
KrisDwyer KrisDwyer is offline
Newcomer
 
Join Date: Jun 2008
Posts: 20
Default

Basically, whilst other controls can be selected etc, the code within them doesnt execute after SaveDialog is finished.
Reply With Quote
  #3  
Old 07-25-2012, 01:45 PM
Gruff's Avatar
GruffFreezing after Save File Dialog Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Have you walked through your code line by line in debug mode?
This will allow you to see the value of each at run-time.

I suspect you have a problem with the final path\file you are trying to open.

Another thing that may be an issue. If you read MS Help for the SaveFileDialog.OpenFile() method it states there can be issues with an existing file.

Finally you are defining 'Chicken' as New after you set it with OpenFile()
I believe this is resetting Chicken to Nothing.

P.S. the plus sign is no longer used to join strings. You need to use the ampersand character instead. & not +
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #4  
Old 07-26-2012, 06:02 AM
DrPunk's Avatar
DrPunkFreezing after Save File Dialog DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Quote:
Originally Posted by Gruff View Post
Finally you are defining 'Chicken' as New after you set it with OpenFile()
I believe this is resetting Chicken to Nothing.
I don't think they are. I can't see that in the code.

But there's no need to create a StreamWriter from the Stream that is returned by OpenFile. chicken should be able to be written to directly.

Code:
If sfd.ShowDialog() = DialogResult.OK Then

    try
        chicken = sfd.OpenFile()

        chicken.WriteLine(SystemVar(1, 201))
        ' etc.

    catch
        messagebox.show(ex.message, "Error saving file")
    finally
        if chicken isnot nothing then
            chicken.close
        end if
    end try
End if
__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog Freezing after Save File Dialog
Freezing after Save File Dialog
Freezing after Save File Dialog
 
Freezing after Save File Dialog
Freezing after Save File Dialog
 
-->