Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:51:01+00:00 2026-06-12T17:51:01+00:00

I would like to have my variable in .txt file. I’ve never done it

  • 0

I would like to have my variable in .txt file. I’ve never done it before (I mean putting variable in .txt file). What should my file consist?
And what should I put into my vb project, when I want to use If function.
ex. my variable name = dzien
value= 0

Private Sub zapisz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)      Handles zapisz.Click
     Open "C:\Plik.txt" For Append As #1 
If dzien = 0 Then
TextBlock1.txt += "dzien jest 0"
End IF

Does this function work if in .txt file there is my variable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:51:02+00:00Added an answer on June 12, 2026 at 5:51 pm

    There are multiple ways to do this. For instance, you could store the value in a text file, a binary file, an XML file, an ini file, or a configuration file. The simplest option is to use the built-in settings framework. To do that, go to your project properties and click on the settings tab. Create a new setting called “DZien” and set the type to an integer. Then, in code, you can access and set the value in the config file like this:

    Dim dzein As Integer = My.Settings.Dzien.ToString()  ' Read value from config file
    My.Settings.Dzien = 5  ' Write new value to config file
    

    Rather, if you want to store a single number in a text file, you could do it like this:

    Dim dzein As Integer = Integer.Parse(File.ReadAllText("C:\Plik.txt")) '  Read value from text file
    File.WriteAllText("C:\Plik.txt", dzein.ToString())
    

    In your case, where you are writing a windows phone app, you could do it like this:

    Partial Public Class_1
        Inherits PhoneApplicationPage
        Private dzien As Integer
    
        Public Sub New()
            InitializeComponent()
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button2.Click
            Try
                dzien = CInt(IsolatedStorageSettings.ApplicationSettings("dzien"))
            Catch ex As KeyNotFoundException
                dzien = 0
            End Try
            If dzien = 0 Then
                ' ...
            End If
        End Sub
    
        Private Sub Class_1_Unloaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Unloaded
            IsolatedStorageSettings.ApplicationSettings("dzien") = dzien
        End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to have a file path like 'C:\Programfiles\file.txt' but i would like
I would like to have a variable (or #define ) in C++ source that
I would like to have my script accepting variable arguments. How do I check
I would like to have the $ (dollar sign) which indicates a php variable
I would like to have a random number generated based of a variable called
I have a variable in my makefile I would like to either unset or
I have a variable of type sbyte and would like to copy the content
I have a variable myvar = document.getElementById('myid').innerHTML that I would like to replace all
I have a variable which contains the value 1234567 . I would like it
I have this string stored in a variable: IN=bla@some.com;john@home.com Now I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.