❔ need help with visual studio community
hi i have multipul q
1- i have mac is there way to have community on it
2- please hoe to make 3 button each one show diffrente pic when click on it
102 Replies
visual studio 2022 community*
1: No. There is something called "Visual Studio for Mac" but its a very very different product. I'd suggest JetBrains Rider for Mac development.
Your other option is visual studio code (or another LSP editor).
2: That sounds like a UI thing. If you are on Mac, that means both WPF and WinForms is unavailable to you, so are you using Avalonia or something like MAUI?
i am using parallel
Thats the virtualization thing where you run windows apps right?
which is i have laggy stupid windows11
but it do for now
In that case, you might be able to use VS Community
until i buy laptop
yes already 😦
but....very laggy
ahhh
but the uni insisted on it
well, its a virtualization tool.
what can i do
Not sure I follow. You can either use VS Community, or you can't. Its a very binary option :p
so for the button u have ny idea how
You need to provide more info
yes i can
What UI framework are you using?
winform app
,net
.net
okay. Then the easiest way is to make a picturebox and 3 buttons
then
then in the OnClick handler for each button, you set the picturebox image to something different
i dont understand the last part
i try to put 3 pic and 3 button
but when i run debug
the pic apears too lol
all
Sure, you could have 3 pictureboxes and just toggle their visibility on/off as appropriate
that works too
how can u teach me please
start with all hidden, and make button 1 show box 1 and hide box 2 and 3
Not really. I don't have visual studio installed, so I can't make winforms apps 😛
hahaha
that sad
how about the cod
anyidea
code
I mean, its near trivial
repeat as needed, and dont forget to wire up the events
so this need to be repeated to the three buttons
yes.
once for each button
what u mean the events?
ok that understand but events?
well, the clicking of a button doesnt do anything unless you have set up the events
in the editor, when you click on a button, it creates the event mapping and an empty method for youi
so just do that for all 3 buttons
ohhhhh
that always automatic been genrated
thats why i didnt understand
u really good damn
there is one more thing hehe
hmm i also actually dont understand
i dont know how to ask even
Create a form as follows. When each button is pressed, the amount of coins is added
to the total sum displayed. When the Clear button is pressed, the total resets to zero
(0.0).
wht in the devil name is this
easy.
i search every where
for an answer
dont have
well, you probably searched for an answer to exactly that problem
are u sure
but what you need is the generic solution to "how do I do something when a button is pressed"
so, you have 6 buttons here. 5 coin buttons and a clear button
aha may i know why passed ?
?
i mean the term u use quite intresting
ok never mind i ma listing
Well if you slow down one sec and think about it
this is not a hard problem, is it?
coin buttons?
coin buttons.
makes sense to me to call them coin buttons
ohhhh
got u so its an add proceces
Process*
so ok can i do q 1 first please dont go ya 10 minuts
i back
?
ok q1 for the pic i did it just now
amazing man thank u soo much
q 2 is the coin one
i am confuse with coding only
okay, so lets break it down a bit
all the coin buttons do the same thing but with a different value. what is the thing that it does?
ok ok
break it down in simple steps
its add i think
like keep adding value
I'd say it does at least 2 things
1: add the value to some counter
2: update the UI
ohh yeah update i forgot
otherwise cant see
the new value
exactly
so, how would you go about coding that?
hahaha lost already
ok ok adding ez
but update i cant
update is easy too
its just
textbox1.Text = yourCounter.ToString();
why tostring()
because your counter is a numeric type
otherwise adding to it wont work as expected
but textboxes only operate on strings
if not numeric?
also this goes in the coin button isit
is it
sure. I'd probably make a helper method thou
so each one will make an update
since all your coinbuttons do the same thing, except for value
so why not have a
AddAndUpdate(int)
methodlost already
ohh this is relace for this one textbox1.Text = yourCounter.ToString();
replace
not entirely
then
i am trying to squize my brain
but feel lost sorry
well, you COULD do this:
but thats silly
why u said silly
because it is
when you can do this
why would I specify my update logic each time, when I can write a helper method and only do it once?
ok wait a second
can i equest sometjing
something
can u explain helper method
its just a method
or its time consuming for u
you can make your own methods. its sort of what programming is 99% about :p
ok so u call it that lol
let me run this give me few minuits
yeah. this is a "helper" in that it just does the thing I want the others to do, but in a generic unified way
yes i got u
hmm
how to do the clear button
lolo
lol
the one reset everything
just type end ?
I mean, that should be very easy, no?
what should the clear button do, do you think?
sorry i was doing the coins button
i would say reset
and if you were to break that down?
end
end program
ahh dont known
why end program?
the instructions dont say anything about that
i am sure its command word in coding
but i was thinking reseat lol
Resetting
lets say you are storing your money in a
decimal money;
variable
how would you reset that?public void Button1_Click()
{
textbox1.Text = reset.ToString();
}
i will put them all inside
reset all
how would that work? what is
reset
?
also, you need to actually reset your money variable...when i try the cod upove it show errer
i really dont know
private TextBox textbox1 = new TextBox();
private decimal money = 0;
i cant type this
it show erreo
error
that wasnt part of the code
like I said, i dont have VS installed
all good
but that error only
no
not working lol
dont just copy paste my code, understand what each line does
that zero i add
believe me i am trying
i give up it rreally cant
what to put here please 😦
need constructor i thing
i think
you shouldnt have that textchanged handler at all
so remove that
its saying AddMoney doesnt exist, so add it
hi sorry
i had an emergency
ok so i will re satrt bececuas if i delet domething in the code its all glitch up
something
busy ? 😦
I see no question.
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.