C
C#2y ago
trinityris

❔ Download picture from button.

I'm trying to create a download button. For example when you click the button, obviously, the photo downloads. I'm having struggles doing this. If anybody can help please do ASAP! (Visual Studio)
33 Replies
Angius
Angius2y ago
Use a link with a download attribute
<a href="cats.png" download>Download</a>
<a href="cats.png" download>Download</a>
trinityris
trinityrisOP2y ago
what do you mean? (new)
Angius
Angius2y ago
I mean exactly and precisely what I said Ah, wait It's not about ASP or anything else web? In that case, Winforms or WPF?
trinityris
trinityrisOP2y ago
huuh asap as if in as soon as possible
Angius
Angius2y ago
Yeah, that threw me off lol So, Winforms? WPF?
trinityris
trinityrisOP2y ago
Angius
Angius2y ago
Winforms To download anything from the internet, use the HttpClient class And to save what you downloaded to a file, use the File class
trinityris
trinityrisOP2y ago
how would i make it downlaod from the internet without a second download button i just want to click it then its downloaded just like on a website
Angius
Angius2y ago
Well, in your button handler method So one of the buttonX_Click ones
Angius
Angius2y ago
trinityris
trinityrisOP2y ago
and where woudk that smileysnek
Angius
Angius2y ago
trinityris
trinityrisOP2y ago
i mean like wheres that im so lost sorry
Anchy
Anchy2y ago
X being the number of the button you want to download with in your case, probably button3
Angius
Angius2y ago
Angius
Angius2y ago
Idk, here, or there Wherver you want the thing to happen You want things to happen when label2 click? Put the things there You want things to happen when button3 click? Put the things there
trinityris
trinityrisOP2y ago
ohh so if thats my button
trinityris
trinityrisOP2y ago
trinityris
trinityrisOP2y ago
inside of that?
Angius
Angius2y ago
Well if you can write your code inside of a picture, then sure Code is usually written... inside of code
trinityris
trinityrisOP2y ago
no like
Angius
Angius2y ago
You have your methods there, in your code
trinityris
trinityrisOP2y ago
the thing that says "picture" is a button
Angius
Angius2y ago
If that's the button3 then yes, use the button3_Click method
trinityris
trinityrisOP2y ago
Angius
Angius2y ago
Yes
trinityris
trinityrisOP2y ago
ohh do you know what code i'd need to write for it?
Angius
Angius2y ago
trinityris
trinityrisOP2y ago
whats that
Angius
Angius2y ago
You're completely new to C#? I thought only to the GUI stuff If you don't know what a class is yet, I highly recommend learning the basics before you jump into stuff like this $helloworld is a good starting point
trinityris
trinityrisOP2y ago
yep alright
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.

Did you find this page helpful?