Tabcontrol into .txt
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Hello, i thought im out of needing help and this is my last help for this minute LOL,
Im trying to do (below) but cant, anyone can help please loove; cooll;
( i will explain what i want in 2 ways so u can understand it xD )
First way:
Can u change this code to all the tabpages instead of selected only? idk how to do it like For Each I ... xD
Second way
I mean if u dont understand the thing in trying to do, this is another expalination xD,
I want to click a button, then ALL TabPages in tabcontrol1 will be saved (.txt) in a folder "C:/Folder" and with name of the selected tab name, also, the way im doing my old code is
Thanks
Im trying to do (below) but cant, anyone can help please loove; cooll;
( i will explain what i want in 2 ways so u can understand it xD )
First way:
Can u change this code to all the tabpages instead of selected only? idk how to do it like For Each I ... xD
Code: Select all
< how to make this code work for all tabpages? i mean 1 click i want all to be done tabpage 1 and 2 and 3 .. etc Dim writer As New IO.StreamWriter("C:\Folder\" & TabControl1.SelectedTab.Text & ".txt")
writer.Write(CType(TabControl1.SelectedTab.Controls.Item(0), TextBox).Text)
writer.Close()
Second way
I mean if u dont understand the thing in trying to do, this is another expalination xD,
I want to click a button, then ALL TabPages in tabcontrol1 will be saved (.txt) in a folder "C:/Folder" and with name of the selected tab name, also, the way im doing my old code is
Code: Select all
this code will work if it was for multipleCType(TabControl1.SelectedTab.Controls.Item(0), TextBox).Text
Thanks
Code: Select all
For Each page As TabPage In TabControl1.TabPages
Dim writer As New IO.StreamWriter("C:\Folder\" & page.Text & ".txt")
writer.Write(CType(page.Controls.Item(0), TextBox).Text)
writer.Close()
Next
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

Thanks #MrAxel , i actually wanted also to load them back, this is harder i know 
This worked great, now i just wanna load them back with the text?
Thanks

This worked great, now i just wanna load them back with the text?
Thanks
Code: Select all
For Each file As String In System.IO.Directory.GetFiles("C:\Folder")
Dim page As New TabPage()
page.Text = Path.GetFileNameWithoutExtension(file)
Dim box As New TextBox()
box.Text = System.IO.File.ReadAllText(file)
page.Controls.Add(box)
TabControl1.TabPages.Add(page)
Next
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

#MrAskel
u r so awesome!, both worked, it took me 20 minutes to figure out that i should put imports system.io LOOL
thanks
thanks!
thhxx +rep!!!


thanks!
thhxx +rep!!!
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023