Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
Saving / Loading List Box Values from specified file
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="mAtUxAz, post: 152180, member: 41919"] Hello, I am creating my own money tracking program. I am in trouble at the part where save and load code of specific file starts. I want to load and save my own created *.mmt files. The files would be loaded and saved through Open / Save As window. What code should I use to load these files? What code should I use to save these files? I'd like to save values of both textboxes into one file. Possible or not? If not - two files is not a problem though. Also, if I can't use specific file extension (*.mmt), a general *.txt file won't ruin my app :tennis: There is my code ============================================================================================================================= Public Class Form1 Private Sub ImportToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ImportToolStripMenuItem.Click OpenFileDialog1.ShowDialog() End Sub Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.ShowDialog() End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text & " got on " & TextBox3.Text & "; " & TextBox2.Text) End Sub Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ListBox2.Items.Add(TextBox6.Text & " spent for " & TextBox5.Text & " on " & TextBox4.Text) End Sub Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click If MessageBox.Show("Have you saved your work?", "Wait!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Me.Close() Else MessageBox.Show("Please save your work!", "Wait!", MessageBoxButtons.OK, MessageBoxIcon.Information) SaveFileDialog1.ShowDialog() End If End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class ============================================================================================================================= And some photos The listbox menu. Probably only Exit function is working without problems. [ATTACH]3482.vB[/ATTACH] Open file window. Nothing happens even if I select *.mmt file (an empty file with *.mmt extension). [ATTACH]3483.vB[/ATTACH] Added entries to both listboxes for a demonstration. Works perfectly. [ATTACH]3484.vB[/ATTACH] Save As file window. No file is saved even if I enter file name and click save. [ATTACH]3485.vB[/ATTACH] That's it. Now, repeating again my questions: What code should I use to load these files? What code should I use to save these files? Will be looking forward to answers! [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
Saving / Loading List Box Values from specified file
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom