C
C#2y ago
Jasiek

❔ how to save text from TextBox to file?

without save file window
21 Replies
x0rld 👻 🎃
with the File.WriteAllText for example 🤔
Jasiek
JasiekOP2y ago
how to write this code?
x0rld 👻 🎃
you have a button or anything to save ?
Jasiek
JasiekOP2y ago
yes
x0rld 👻 🎃
so you have something like
void MyButtonClick(...)
{
File.WriteAllText(thestring);
}
void MyButtonClick(...)
{
File.WriteAllText(thestring);
}
Jasiek
JasiekOP2y ago
ok thank
x0rld 👻 🎃
File.WriteAllTextAsync Method (System.IO)
Asynchronously creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.
Jasiek
JasiekOP2y ago
what is File
x0rld 👻 🎃
a class
Jasiek
JasiekOP2y ago
ok
x0rld 👻 🎃
you should start with the basics
Jasiek
JasiekOP2y ago
what do you mean
x0rld 👻 🎃
if you don't know recognize a class you need to learn basics before going into a gui app with more complexity 🤔
Jasiek
JasiekOP2y ago
nvm @x0rld you know how to load from txt to textbox?
x0rld 👻 🎃
load text ?
Jasiek
JasiekOP2y ago
yes
x0rld 👻 🎃
what do you mean ?
Jasiek
JasiekOP2y ago
click button and it load text from txt to TextBox
x0rld 👻 🎃
there is a method in the File class to load text from file after it's just a string you can put in your textbot
Jasiek
JasiekOP2y ago
okaay
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server