|
-
Apr 18th, 2005, 12:37 AM
#1
Thread Starter
Junior Member
Saving Contents of TextBoxes
Hi guys,i'm currently writing an application that collects data from users through the use of textboxes.How do i save the data as a CSV file?
Please help in anyway u can,i'm in real need of some help here.
-
Apr 18th, 2005, 04:04 AM
#2
Fanatic Member
Re: Saving Contents of TextBoxes
This code goes through all textboxes on the form and adds the text from each textbox to a line to be wrote to file. the line is appended to any previous lines in the csv file
VB Code:
Dim l_sWriter As New StreamWriter("myfile.csv", TRUE)
Dim l_csvLine As String
Try
Dim l_ctrl As Control
For each l_ctrl In me.Controls
If Typeof(l_ctrl) is textbox Then
l_csvLine &= l_ctrl.text & ","
End IF
Next
'Remove the trailing comma
l_csvLine = Mid(l_csvLine, 1, l_csvLine.Length - 1)
'Write the data to the file
l_sWriter.WriteLine(l_csvLine)
l_csvLine = ""
End While
Catch ex As IOException
MsgBox(ex.Message, MsgBoxStyle.Information, "ManoWave")
Finally
l_sWriter.Close()
End Try
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Apr 18th, 2005, 04:27 AM
#3
Thread Starter
Junior Member
Re: Saving Contents of TextBoxes
Thank you for those lines of codes.I'll go work on it !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|