C
C#17mo 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
Angius17mo ago
Use a link with a download attribute
<a href="cats.png" download>Download</a>
<a href="cats.png" download>Download</a>
trinityris
trinityrisOP17mo ago
what do you mean? (new)
Angius
Angius17mo 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
trinityrisOP17mo ago
huuh asap as if in as soon as possible
Angius
Angius17mo ago
Yeah, that threw me off lol So, Winforms? WPF?
trinityris
trinityrisOP17mo ago
Angius
Angius17mo 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
trinityrisOP17mo 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
Angius17mo ago
Well, in your button handler method So one of the buttonX_Click ones
Angius
Angius17mo ago
trinityris
trinityrisOP17mo ago
and where woudk that smileysnek
Angius
Angius17mo ago
trinityris
trinityrisOP17mo ago
i mean like wheres that im so lost sorry
Anchy
Anchy17mo ago
X being the number of the button you want to download with in your case, probably button3
Angius
Angius17mo ago
Angius
Angius17mo 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
trinityrisOP17mo ago
ohh so if thats my button
trinityris
trinityrisOP17mo ago
trinityris
trinityrisOP17mo ago
inside of that?
Angius
Angius17mo ago
Well if you can write your code inside of a picture, then sure Code is usually written... inside of code
trinityris
trinityrisOP17mo ago
no like
Angius
Angius17mo ago
You have your methods there, in your code
trinityris
trinityrisOP17mo ago
the thing that says "picture" is a button
Angius
Angius17mo ago
If that's the button3 then yes, use the button3_Click method
trinityris
trinityrisOP17mo ago
Angius
Angius17mo ago
Yes
trinityris
trinityrisOP17mo ago
ohh do you know what code i'd need to write for it?
Angius
Angius17mo ago
trinityris
trinityrisOP17mo ago
whats that
Angius
Angius17mo 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
trinityrisOP17mo ago
yep alright
Accord
Accord17mo 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