2 Questions
Hi, I need to ask 2 questions as i am new to C#. So im missing 2 tasks to deploy my first app. And ive been struggling to find help on Youtube for my concerns.
My first question. how can i give a button 2 events. for example
"If radioButton_1 is selected, process.start <File X>"
"if radioButton_2 is selected, process.start <File Y>"
how can i do that?
My second question is how can i give a file directory template.
in an example
C:%filelocation%%filepath% something around those lines.
Help Appreciated!
6 Replies
1. Bind to the click event of the radio button and add whatever code you wish
2. Do you want to create a path dynamically, or get a "universal" path, for example to user desktop no matter who the user is?
2. to user desktop
Environment.GetFolderPath(EnvironmentFolders.SpecialFolder.Desktop)
I believe
https://learn.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-8.0
https://learn.microsoft.com/en-us/dotnet/api/system.environment.getfolderpath?view=net-8.0
I was not correct in my beliefs there, fixed itis there a microsoft learn link for the first. i still dont get it. or an example.
That is the link
SpecialFolder
is an enum
It contains values like .Desktop
Using the method from the second link, you can turn that into a path
So Environment.GetFolderPath(EnvironmentFolders.Desktop)
becomes C:/Users/zp4eternity/Desktop/
Then just use Path.Combine()
to append more path segments if neededstill struggling for the bind to the....