By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,027 Members | 1,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,027 IT Pros & Developers. It's quick & easy.

How to save small amount of data to text file

P: n/a
Hi

i am using visual studio.net 2003 EA Edition and trying to use vb.net to
write the values of a text box to a text file. I would like to write a csv
file or an excel spreadsheet from the text box.
I have 20 text boxes and would like to write them like this:
1,2,3,4,5,6,7,8,9,10 .... 20

all values will be strings.
Any help appreciated

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Gordon,.

Use a string builder,
Someting as
\\\
dim mysb as new stringbuilder
mysb.add(mytextbox1.text)
mysb.add(",")
mysb.add(mytextbox2.text)
'and so on.
dim mystring to write = mysb.tostring
///

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
"gordon" <go**********@optusnet.com.au> schrieb:
i am using visual studio.net 2003 EA Edition and trying to use vb.net to
write the values of a text box to a text file. I would like to write a
csv file or an excel spreadsheet from the text box.
I have 20 text boxes and would like to write them like this:
1,2,3,4,5,6,7,8,9,10 .... 20


Take a look at the classes in the 'System.IO' namespace, namely
'StreamWriter'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
Thanks Cor

But this doesn't seem to work for me ...

I have:
Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click

Dim player1 As String

Dim player2 As String

Dim player3 As String

Dim player4 As String

'this part saves the info for the players

player1 = TextBox1.Text

player2 = TextBox2.Text

player3 = TextBox3.Text

player4 = TextBox4.Text

'continues up to player20

Dim mysb As New Stringbuilder

mysb.add(TextBox1.Text)

mysb.add(",")

mysb.add(TextBox2.Text)

dim mystring to write = mysb.tostring

End Sub

and i get syntax error with this code.


But the syntax
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Gordon,.

Use a string builder,
Someting as
\\\
dim mysb as new stringbuilder
mysb.add(mytextbox1.text)
mysb.add(",")
mysb.add(mytextbox2.text)
'and so on.
dim mystring to write = mysb.tostring
///

I hope this helps,

Cor

Nov 21 '05 #4

P: n/a
Gordon,

and i get syntax error with this code.


Can you show us what is the content of that syntax code?

Cor
Nov 21 '05 #5

P: n/a
"gordon" <go**********@optusnet.com.au> schrieb:
Dim mysb As New Stringbuilder

mysb.add(TextBox1.Text)

mysb.add(",")

mysb.add(TextBox2.Text)

dim mystring to write = mysb.tostring

End Sub

and i get syntax error with this code.


Maybe 'Imports System.Text' is missing on top of the file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.