C
C#3y ago
Jasiek

❔ how to save text from TextBox to file?

without save file window
21 Replies
x0rld
x0rld3y ago
with the File.WriteAllText for example 🤔
Jasiek
JasiekOP3y ago
how to write this code?
x0rld
x0rld3y ago
you have a button or anything to save ?
Jasiek
JasiekOP3y ago
yes
x0rld
x0rld3y ago
so you have something like
void MyButtonClick(...)
{
File.WriteAllText(thestring);
}
void MyButtonClick(...)
{
File.WriteAllText(thestring);
}
Jasiek
JasiekOP3y ago
ok thank
x0rld
x0rld3y ago
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
JasiekOP3y ago
what is File
x0rld
x0rld3y ago
a class
Jasiek
JasiekOP3y ago
ok
x0rld
x0rld3y ago
you should start with the basics
Jasiek
JasiekOP3y ago
what do you mean
x0rld
x0rld3y ago
if you don't know recognize a class you need to learn basics before going into a gui app with more complexity 🤔
Jasiek
JasiekOP3y ago
nvm @x0rld you know how to load from txt to textbox?
x0rld
x0rld3y ago
load text ?
Jasiek
JasiekOP3y ago
yes
x0rld
x0rld3y ago
what do you mean ?
Jasiek
JasiekOP3y ago
click button and it load text from txt to TextBox
x0rld
x0rld3y ago
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
JasiekOP3y ago
okaay
Accord
Accord3y 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.

Did you find this page helpful?