C
C#2y ago
Jasiek

❔ how to save text from TextBox to file?

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