Button that downloads a file from a link to a website
I need to click a button and it will download a file from a website link
144 Replies
HttpClient
@ZZZZZZZZZZZZZZZZZZZZZZZZZ can you explain or help more
SO
where would i input the URL
to the download/file
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Where.... it says
requestUrl
just making sure sorry
im sort of new to all this
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Also i'd put this in the button click right?
Basically
i've got some errors
The method needs to be
async void
not just void
oh got it
And I guess you're using an old version of the language, so use a
using
block not statement
And, well, all the variables that don't exist anywherelike
awating ect.
?
wait
mb
im not sure i understand this part
sorry
Google is your friend in cases like those
oh alr
and btw
i put the link into where u said
and
Strings in C# need quotes around them
The using is still a statement not a block
And you have one more nonexistent variable
the file path?
is the missing variable?
Yes
does it go in quotes?
If you want to use a literal path there and not a variable, yes
As I already said...
Angius
Strings in C# need quotes around them
Quoted by
<@85903769203642368> from #Button that downloads a file from a link to a website (click here)
React with ❌ to remove this embed.
if u wanted it to go to downloads it'd be c://Downloads
right
@ZZZZZZZZZZZZZZZZZZZZZZZZZ can you help i still dont know what to change using to
@ZZZZZZZZZZZZZZZZZZZZZZZZZ another thing i dont the button is working anyway for some reason
I guess Google fails somethimes, huh?
using
statement
using
block
@ZZZZZZZZZZZZZZZZZZZZZZZZZ where do i put it now i have 44 errors
Well not there
where lmao
Instead of the using statement use the using block
As I said before
yeah no ik that i mean like
idk what to do
tbh
I just told you
Instead of
make it
Or use a non-outdated version of the language
ik where do i put it
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Where you have it...?
If someone tells you to replace
A
with B
that means you already have A
So take out the A
, and put B
in its place
I cannot be any more clear or I'll turn transparentno bro what do i replace it with
like what line
What part of their directions are you confused by?
Angius
Instead of
make it
Quoted by
<@446416451230760990> from #Button that downloads a file from a link to a website (click here)
React with ❌ to remove this embed.
Where do i put this code
what line
I'm out
the place i put it before you said was incorrect
Please replace
Jumped over
with Crawled under
My dude
Look at the sample Z gave you
Then look at your code
The "instead of" is shaped like a particular line
homie its not in my code
where tf u see user var foo at
lmao bro
Jesus
It's an example
You have something that looks similar
my boy
then js tell me
No
Turn your brain back on
bro u cant yell at me for not knowing what to replace when nothing is similar to it
Do you not see the using line already in your code?
the only error
i see that
i replaced it
more errors bro
its ONE line that says using
which producing the error
Yes
And you were told to replace that with a different thing
Z was very clear
ik
and i did
and i got more errors bro
This is painful to read
Then show them
so instead of "using var" i replace that with the bs he gave me
he gave you psuedo code
Not even pseudo
It's very concrete
True 😅
just fucking tell me what to replace it with so i can see it
is it that hard bro
We did
not a example that has 0 relevance or resembelence to what im dealing with
Angius
Instead of
make it
Quoted by
<@446416451230760990> from #Button that downloads a file from a link to a website (click here)
React with ❌ to remove this embed.
And I thought human brain evolved pattern recognition too well
And if you already did that, show the new code and errors
in case ya noticed THAT example doesnt show a relevance
We are not here to spoonfeed
MemeZ
Quoted by
<@446416451230760990> from #Button that downloads a file from a link to a website (click here)
React with ❌ to remove this embed.
Is that current?
i've told u numerous times im new to this
but when you tell me to replace something thats not there
i cant
annd yes
BRO
THATS WHAT I DID
WHAT DONT U GET
why would it give me more errors
Then show the updated code already
It should have a using block
Exactly like Z told you to do
i replace this highlighted line with
what he put
Angius
Instead of
make it
Quoted by
<@446416451230760990> from #Button that downloads a file from a link to a website (click here)
React with ❌ to remove this embed.
You are supposed to be using the second one
?
<:picard_facepalm:616692703685509130>
I'm done
i dont know a single bit of C# bro
Do you notice certain similarities?
Adapt the examples given to your code
formats ect.
yk what js how tf do i update
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
I told you
Even made a pretty picture
js tell me how to update
i dont wanna fix it
js tell me how to update C# to 8
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Well, depends
If it's a .NET Framework project, you might need to use an upgrade assistant
alright
If it's a modern .NET project, just change the number in project properties
okay how do i check if its "modern"
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
If you made a project in green it's good
If you made a project in red it's bad
im guessin this is bad
then
Upgrade Assistant
alright how
Or you could try editing the
.csproj
manually
Or you could make a new project with a new version of .NET and copy the code over
Whichever you preferwould this most likley work
Seeing how 4.8 is the newest of old Framework versions, it just might
okay can u show me how to edit it
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
You'll have to edit
TargetFramework
to, say, net7.0
and LangVersion
to, say, 11
where can i do that
Inside of the
.csproj
file...?
And just to get ahead of you, no, the file is not literally named .csproj
It's YourProjectName.csproj
And no, it's not literal YourProjectName.csproj
But rather, well, your project's name
With the extension .csproj
Open it with any text editor, Notepad, Notepad++, whatever
Edit
Saveik im in
i cant find the lanf v
lang version
*
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
What does your
.csproj
file look like?Eh, it might work
Not entirely sure, to be honest
It's been ages since I worked with legacy Framework last, and I never had to port anything to modern .NET either
so what abt the lang version?
is that all i needed to do
Lang version might not be needed
alright
Or you can try just adding it there manually
Right now, see if it works
alright
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
¯\_(ツ)_/¯ then
You'll have to find someone more well-versed
Or use the upgrade assistant maybe
alrigiht
Never used it myself, but people say it does help
instead of downloading the file straight on
can i make a website redirect?
What do you mean?
like u click the button
and it brings you to a website
Sure
alright how exactly would that work
Process.Start("http://google.com")
should be all you needoh alr
let me see
It's in the
System.Diagnostics
namespacedo i keep the async?
on the button
the button didn't do anything
No need for async if you're not awaiting inside
thought so
but it still didn't work
no error
just nothing happens
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Odd, it should work
niether did message boxes
Ah
maybe?
literally nothing
could it be the linking to the button maybe?
the settings
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
Does anything happen when you click the button?
Would be best if you were to debug it
See if breakpoints are being hit
no absolutley nothin
what could it be
@ZZZZZZZZZZZZZZZZZZZZZZZZZ
No idea
damn