❔ 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
Use a link with a
download
attribute
what do you mean? (new)
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?
huuh
asap as if in as soon as possible
Yeah, that threw me off lol
So, Winforms? WPF?
Winforms
To download anything from the internet, use the
HttpClient
class
And to save what you downloaded to a file, use the File
classhow 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
Well, in your button handler method
So one of the
buttonX_Click
onesand where woudk that
i mean like wheres that
im so lost
sorry
X being the number of the button you want to download with
in your case, probably button3
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
ohh
so if thats my button
inside of that?
Well if you can write your code inside of a picture, then sure
Code is usually written... inside of code
no like
You have your methods there, in your code
the thing that says "picture" is a button
If that's the
button3
then yes, use the button3_Click
methodYes
ohh
do you know what code i'd need to write for it?
whats that
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
Written interactive course https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/
Videos https://dotnet.microsoft.com/learn/videos
yep
alright
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.