473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How to save small amount of data to text file

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
5 2627
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
"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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: deko | last post by:
I need to create different recordsets based on queries that use data from unbound fields in a form. I've discovered that I can't do this, and instead need to save the data in question (usually a...
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...
2
by: Scott M. Lyon | last post by:
I'm working on a WinForm application, and recently was informed that I need to create an "Export" function for the data (stored in SQL Server), in a specific (TXT, tab delimited) format. I'd...
2
by: nuhura01 | last post by:
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()...
0
by: amrhi | last post by:
Hy Guys , Can anybody help me ? I try to make small web database in my unit. Some of fields have on change behaviour to get other data that automatically filled other text field. But when i try to...
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...
23
by: arnuld | last post by:
My friend sent me the prototype of a game written in C++ and asked for advice: IDEA: Game will ask the user to thin of a number. User will press a keystroke after he has thought of a number....
7
geolemon
by: geolemon | last post by:
I'm getting an error, I'm not seeing the cause: Debug highlights this segment of code (I just snipped a portion here): strProc = "Insert into Parts (MfgPN, Manufacturer, Description)" & _ ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.