❔ need some help for school assignment - changing image via variable

hey, having problems building a microsoft form in c#, part of my assignment is to build a basic educational game, in order to make it slightly more friendly to children my group decided to add an option to pick a profile image just as an additional thing to keep kids from being completely bored to death. I have tried a few different methods and cannot get the image to change unless its an event on clicking the initial selection of images (image 1), this also assigns a variable "intProfile" a number and i was hoping that on form2 loading i could use an if statement to change a picture box in the corner. its refusing to work, any help would be greatly appreciated
13 Replies
Angius
Angius2y ago
= is for assignment == is for comparison And it also gives you a bool, no need to convert anything
SirRodgerBottoms
SirRodgerBottomsOP2y ago
i was being forced to convert to bool, but will test the == to see if that works
Jimmacle
Jimmacle2y ago
globalvar pepesus
SirRodgerBottoms
SirRodgerBottomsOP2y ago
goddamn that worked, thank you lol so i can carry the selection over from form to form
Angius
Angius2y ago
If it didn't work, it'd mean C# itself is broken
Jimmacle
Jimmacle2y ago
there is almost definitely a better way to pass data between objects than a bunch of global variables, but would need more context
SirRodgerBottoms
SirRodgerBottomsOP2y ago
i was having so many troubles last night getting it to work without it being on click so i figured it would work doing it on load on the next form, just forgot the double == lol
Jimmacle
Jimmacle2y ago
also, you don't need Convert and it's not really used anymore
SirRodgerBottoms
SirRodgerBottomsOP2y ago
i imagine so but for this class thats how we have been taught and i think they expect to see variables done that way for now i was getting errors without it
Jimmacle
Jimmacle2y ago
any object has a ToString() method defined on it, and to go the other way they have static parsing methods defined
Angius
Angius2y ago
Ah, a school project Well, bad practices are to be expected
Jimmacle
Jimmacle2y ago
that was my favorite part about school being forced to write shitty code because that's how the professors wanted it
SirRodgerBottoms
SirRodgerBottomsOP2y ago
yeah going back to school later in life after learning redundant things on byond and gamemaker lol
Want results from more Discord servers?
Add your server