473,465 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

save text from text box into text file

Hi..

I'm trying to save query path which is in text box to text file. Below
is the coding that i'm using currently:

Private Sub SaveQueryPath()
'save to text file
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition",
"attachment;filename=Query1.txt")
Response.ContentType = "application/vnd.text"
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Me.EnableViewState = False

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(txtPath)
txtPath.RenderControl(oHtmlTextWriter)

Response.Write(oStringWriter.ToString())
Response.End()
End Sub

The 'txtPath' is the text box that contains a query path that I want
to save.

However, when i open the text file, after i run and save the query,
the result in the text file shows the query path (which i need)
including the properties of the text box which is unnecessary for me.
For example(text saved):

<input name="txtPath" type="text" value=" STP --Select One-- >
" id="txtPath" disabled="disabled" style="background-
color:WhiteSmoke;font-family:Verdana;font-size:X-Small;width:712px;" /
>
The only thing that i want to save is (the query path): value=" STP
--Select One-- "
Is there anybody can help me on how to get rid of all the other
unnecessary info saved in the text file?

Hope to hear from you guys... Your help is highly appreciated.

Thank you.

Feb 8 '07 #1
2 9597
Hi,

Why do you not use the streamwriter, a very nice exsample is on this page.

http://msdn2.microsoft.com/en-us/lib...3w(VS.80).aspx

Cor

<nu******@yahoo.comschreef in bericht
news:11**********************@v33g2000cwv.googlegr oups.com...
Hi..

I'm trying to save query path which is in text box to text file. Below
is the coding that i'm using currently:

Private Sub SaveQueryPath()
'save to text file
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition",
"attachment;filename=Query1.txt")
Response.ContentType = "application/vnd.text"
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Me.EnableViewState = False

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(txtPath)
txtPath.RenderControl(oHtmlTextWriter)

Response.Write(oStringWriter.ToString())
Response.End()
End Sub

The 'txtPath' is the text box that contains a query path that I want
to save.

However, when i open the text file, after i run and save the query,
the result in the text file shows the query path (which i need)
including the properties of the text box which is unnecessary for me.
For example(text saved):

<input name="txtPath" type="text" value=" STP --Select One-- >
" id="txtPath" disabled="disabled" style="background-
color:WhiteSmoke;font-family:Verdana;font-size:X-Small;width:712px;" /
>>

The only thing that i want to save is (the query path): value=" STP
>--Select One-- "
Is there anybody can help me on how to get rid of all the other
unnecessary info saved in the text file?

Hope to hear from you guys... Your help is highly appreciated.

Thank you.

Feb 8 '07 #2
On Feb 8, 1:38 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Hi,

Why do you not use the streamwriter, a very nice exsample is on this page.

http://msdn2.microsoft.com/en-us/lib...3w(VS.80).aspx

Cor

<nuhur...@yahoo.comschreef in berichtnews:11**********************@v33g2000cwv.g ooglegroups.com...
Hi..
I'm trying to save query path which is in text box to text file. Below
is the coding that i'm using currently:
Private Sub SaveQueryPath()
'save to text file
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition",
"attachment;filename=Query1.txt")
Response.ContentType = "application/vnd.text"
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Me.EnableViewState = False
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
Me.ClearControls(txtPath)
txtPath.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
End Sub
The 'txtPath' is the text box that contains a query path that I want
to save.
However, when i open the text file, after i run and save the query,
the result in the text file shows the query path (which i need)
including the properties of the text box which is unnecessary for me.
For example(text saved):
<input name="txtPath" type="text" value=" STP --Select One-- >
" id="txtPath" disabled="disabled" style="background-
color:WhiteSmoke;font-family:Verdana;font-size:X-Small;width:712px;" /
The only thing that i want to save is (the query path): value=" STP
--Select One-- "
Is there anybody can help me on how to get rid of all the other
unnecessary info saved in the text file?
Hope to hear from you guys... Your help is highly appreciated.
Thank you.- Hide quoted text -

- Show quoted text -
Hi Cor,

What i'm trying to do is actually for 'Export to Text File' button.
The code behind the button is where it calls SaveQueryPath() function,
which i've posted earlier. Do you have any examples or suggestions to
solve it?

Thank you.

Feb 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: BadOmen | last post by:
I have a text file that I want to save from my program. But I don't want to save the empty lines. I want to delete everything after the last character, Is that possible? Then when I read the...
3
by: Newbie | last post by:
I am trying to get the save/open dialog figured out. I am able open the save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below...
2
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0"...
0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
8
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
4
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.