Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Tutorial]Saving/Loading a Listbox Contents

[Tutorial]Saving/Loading a Listbox Contents

Posts 1–14 of 14 · Page 1 of 1
Bombsaway707
Bombsaway707
[Tutorial]Saving/Loading a Listbox Contents
Ok guys so heres a short simple tutorial on how to Save/Load a listbox and its contents.
1. Add a listbox to a form(obviously)
2. Now under public class form 1 add this:
Code:
Inherits System.Windows.Forms.Form
Dim w As IO.StreamWriter
    Dim r As IO.StreamReader
3. Now to save a listbox contents use this code:
Code:
Dim i As Integer
        w = New IO.StreamWriter(Save Location Here. Save as .txt file)
        For i = 0 To ListBox1.Items.Count - 1
            w.WriteLine(ListBox1.Items.Item(i))
        Next
        w.Close()
4. Now to load a listbox contents.
Code:
r = New IO.StreamReader("Load location here. must load from .txt file)
        While (r.Peek() > -1)
            ListBox1.Items.Add(r.ReadLine)
        End While
        r.Close()
Its as simple as that.
Now for a side note: You must save a listbox contents to a .txt file before you can load them. Also the save location should be as same as the save location.
Now the entire code put together:
Code:
Public Class Form1
    Inherits System.Windows.Forms.Form
 Dim w As IO.StreamWriter
    Dim r As IO.StreamReader

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        w = New IO.StreamWriter("c:\test.txt")
        For i = 0 To ListBox1.Items.Count - 1
            w.WriteLine(ListBox1.Items.Item(i))
        Next
        w.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        r = New IO.StreamReader("c:\test.txt")
        While (r.Peek() > -1)
            ListBox1.Items.Add(r.ReadLine)
        End While
        r.Close()
    End Sub
End Class
#1 · edited 16y ago · 16y ago
NextGen1
NextGen1
Looks Good , Thank you
#2 · 16y ago
Bombsaway707
Bombsaway707
Quote Originally Posted by NextGen1 View Post
Looks Good , Thank you
Thanks and i can say confidently that this tut isnt leeched since i wrote it up myself xD
#3 · 16y ago
hopefordope
hopefordope
Sorry if i bumped this but i hav a question
can u do this same with a txt box
#4 · 16y ago
mnpeepno2
mnpeepno2
you cant use items.add but yes, you can
looks good.
#5 · 16y ago
Bombsaway707
Bombsaway707
Quote Originally Posted by hopefordope View Post
Sorry if i bumped this but i hav a question
can u do this same with a txt box
Yes, although the saving/loading code wouldnt be the same.
#6 · 16y ago
XG
XGelite
so would this work for .xml files as well?
#7 · 16y ago
Zoom
Zoom
Great tutorial!
#8 · 16y ago
Bombsaway707
Bombsaway707
Quote Originally Posted by XGelite View Post
so would this work for .xml files as well?
Although it would not be the same save/load code i suppose it could be implemented for .xml files
Quote Originally Posted by hejsan1 View Post
Great tutorial!
Thank you
#9 · 16y ago
hopefordope
hopefordope
so what would it be if i wanted to save it to the desktop
w = New IO.StreamWriter(Save Location Here. Save as .txt file)
#10 · 16y ago
NextGen1
NextGen1
"C:\Documents and Settings\User\USERNAME
\Desktop\"

so.....

Code:
w = New IO.StreamWriter("C:\Documents and Settings\User\USERNAME
\Desktop\sample.txt")
You can use the code

Code:
Enviroment.Username
to get the username

so to save to anyones desktop

Code:
dim usern as enviroment.username

w = New IO.StreamWriter("C:\Documents and Settings\User\" & usern & "\Desktop\sample.txt")
#11 · edited 16y ago · 16y ago
PI
Pixipixel_
Hehehe good job, great tut
#12 · 16y ago
Bombsaway707
Bombsaway707
Quote Originally Posted by Pixipixel_ View Post
Hehehe good job, great tut
Thanks man
#13 · 16y ago
hopefordope
hopefordope
Quote Originally Posted by NextGen1 View Post
"C:\Documents and Settings\User\USERNAME
\Desktop\"

so.....

Code:
w = New IO.StreamWriter("C:\Documents and Settings\User\USERNAME
\Desktop\sample.txt")
You can use the code

Code:
Enviroment.Username
to get the username

so to save to anyones desktop

Code:
dim usern as enviroment.username

w = New IO.StreamWriter("C:\Documents and Settings\User\" & usern & "\Desktop\sample.txt")
it says that Type'Environment.username' is not defined..... i tryed the usern = blalalal method but it still didnt work this is my [php]Dim i As Integer
Dim usern As Environment.Username
w = New IO.StreamWriter("C:\Documents and Settings\User\" & usern & "\Desktop\sample.txt")
For i = 0 To Dlls.Items.Count - 1
w.WriteLine(Dlls.Items.Item(i))
Next
w.Close()[/php]
#14 · 16y ago
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Similar Threads

  • [Tutorial]Saving Checkbox True/False StatementBy Blubb1337 in Visual Basic Programming
    11Last post 16y ago
  • [Injector] Pornject ++ Internet Stream ++ Save\Load [v3]By XxDragonSharKxX in CrossFire Spammers, Injectors and Multi Tools
    6Last post 16y ago
  • Simple Save/LoadBy kotentopf in Combat Arms Hack Coding / Programming / Source Code
    8Last post 15y ago
  • [Help] VB.NET 2008 - Saving ListBox Items in SettingsBy Samueldo in Visual Basic Programming
    12Last post 16y ago
  • [Tutorial] New Way to make CA load fasterBy Andyklk2009 in Combat Arms Hacks & Cheats
    13Last post 17y ago

Tags for this Thread

None