Dim FILE_NAME As String = "D:\server.cfg"
Dim objReader As New System.IO.StreamReader(FILE_NAME)
ServerCFG.Text = objReader.ReadToEnd
objReader.Close()
That loads the file back into the textbox on page load............. on the
page is up there is a button that you can click to save the changes which
has this in it:
Private Sub ButtonSaveChanges_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles ButtonSaveChanges.Click
Dim fs As FileStream = File.Create("D:\server.cfg")
Dim sw As StreamWriter = New StreamWriter(fs)
Try
sw.Write(ServerCFG.Text)
sw.Close()
fs.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try
LabelServerCFG.Text = "Server CFG has been Updated"
End Sub
I tried this once and it actually saved
something...............................
Private Sub ButtonSaveChanges_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles ButtonSaveChanges.Click
Dim fs As FileStream = File.Create("D:\server.cfg")
Dim sw As StreamWriter = New StreamWriter(fs)
strTest = Request.Form("ServerCFG")
Try
sw.Write(strTest)
sw.Close()
fs.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try
LabelServerCFG.Text = "Server CFG has been Updated"
End Sub
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Dean Fiala
Sent: Tuesday, August 09, 2005 7:01 PM
To: [email protected]
Subject: Re: [AspNetAnyQuestionIsOk] .TxtFIle says its saved but no change
Are you reloading during your postback? Let's see your page_load code.
On 8/9/05, Mike Belcher <[EMAIL PROTECTED]>
wrote:
> I have trace on with this particular page. I I look at the Form Collection
> for this textbox it shows the changes in it after postback. But I
> response.write the value of the textbox and it shows the old value. I
guess
> this is whats happening........ how to fix this?
>
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mike Belcher
> Sent: Tuesday, August 09, 2005 4:44 PM
> To: [email protected]
> Subject: RE: [AspNetAnyQuestionIsOk] wow solve one issue then
> another.TxtFIle says its saved but no change
>
> See that is the mystifying thing there. No error and if you look on the
hard
> drive itself the file has been saved as the time changes. But the edits
made
> in the textbox do not seem to be reflected in the saved file. It remains
the
> same as when it was loaded. I do this same type of stuff with db fields a
> ton and the changes are saved but for some reason im not getting the
edited
> changes on the file in this case.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Renz
> Sent: Tuesday, August 09, 2005 4:27 PM
> To: [email protected]
> Subject: Re: [AspNetAnyQuestionIsOk] wow solve one issue then
> another.TxtFIle says its saved but no change
>
> try to do a catch to see if you are getting an error
>
> Dim fs As FileStream = File.Create("D:\server.cfg")
> Dim sw As StreamWriter = New StreamWriter(fs)
> try
> sw.Write(ServerCFG.Text)
> sw.Close()
> fs.Close()
> catch ex as Exception
> lblMessage.Show
> lblMessage.Text = ex.Message
> end try
>
>
>
>
> >>> [EMAIL PROTECTED] 08/09/2005 1:19:59
> PM >>>
>
> Permissions work........... I have a page now that loads a cfg file
> from the
> disk and puts it in a textbox control. This works great. I then have a
> save
> changes button that will save the contents of the textbox back to the
> file.
> The problem is that I make changes and save and when you check the file
> it's
> the same. I have looked on the disk and the date and time change so it
> is
> writing it but apparently no the edited changes. Here is the code.
>
>
>
> Opening routine.
>
> Dim FILE_NAME As String = "D:\server.cfg"
>
> Dim objReader As New System.IO.StreamReader(FILE_NAME)
>
> ServerCFG.Text = objReader.ReadToEnd
>
> objReader.Close()
>
>
> Saving Routine
>
> Dim fs As FileStream = File.Create("D:\server.cfg")
> Dim sw As StreamWriter = New StreamWriter(fs)
> sw.Write(ServerCFG.Text)
> sw.Close()
> fs.Close()
>
>
> As I said it all works and even shows that the file has been saved but
> the
> things I changed in the textbox don't seem to be there.
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hd9gbru/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123646642/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/