[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB.net System.IO Write a text file for incrementing number

Posted on 2014-04-07
2
Medium Priority
?
580 Views
Last Modified: 2014-04-07
Hi

I need to use a numbering system in my VB.net app that increments by one every time
I perform an action. I want it to start at 1 then move to 2, then 3 and so on.
What VB.net code would I use to write a text file that handles this?

Thanks
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 39983443
Create a counter variable and add 1 every time that action is preformed.

Dim iCounter As Integer = 0
Dim FILE_NAME As String = "C:\Users\Owner\Documents\test.txt"

If System.IO.File.Exists(FILE_NAME) = True Then
    Dim oWriter As New System.IO.StreamWriter( FILE_NAME )
    oWriter.Write(TextBox1.Text)
    oWriter.Close()
    iCounter = iCounter + 1
    MsgBox("Text written to file")
Else
    MsgBox("File Does Not Exist")
End If

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 39983462
Great! Thanks very much for that
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question