β dont judge D:
basically im the newest newest can get, how do you make a text say different things when you press space bar?
84 Replies
if u have a video link that will be good for the basic stuff that will be nice too
Awesome! Welcome to the world of programming. To answer your question ,you must provide a biiit more context.
For example, what application are you writing? Is it a WinForm? A WPF? A web app? or maybe a classic console application?
i think... visual studios?
c#?
.net?
C# is your programming language
Visual Studio is the IDE - in simple terms, the editor which you use to write your projects
Have you created anything already in Visual Studio, the editor?
They probably just have a console app
nope
ive created only the very basic text
nice, but where did you create it? Could you share a screenshot of where you placed the text?
?
Ah, you are using Visual studio code
Are you following a youtube tutorial?
idk any good ones
you got any links?
$helloworld
Written interactive course https://learn.microsoft.com/en-us/users/dotnet/collections/yz26f8y64n7k07
Videos https://dotnet.microsoft.com/learn/videos
AngelSix
YouTube
C# Mastery Course - Introduction
Support me in my journey to giving back to the industry all my knowledge and helping the world with what I do. Spreading knowledge to those who cannot afford an education, and helping those who want to better themselves.
Support what I do and pay for me to survive
https://www.angelsix.com/donate
Merchandise
https://teespring.com/stores/angelsi...
you got any links for what im asking tho
Please download Visual Studio Community Edition 2022
?
Visual Studio Community 2022 is a far more fully-featured and beginner-friendly editor than VSCode
You have Visual Studio Code. It is quite barebones unless you configure it. I do not recommend a beginner to us VS Code, as it does not provide enough tools to help you learn to code
link?
Google?
Don't expect to be handfed everything
D:
i have a different google
Don't be afraid to Google a bit. It's what you'll be doing a lot on your programming journey
if you mean bing, then all power to you
microsoft edge
That is a browser
not a search engine
whats the difference
You for real?
??
I suppose they are young
you do the same thing on google and explorer
no one sits me down "hey, browser and search engine is different"
well, sorry to break to you, it is different.
Browser is the program on your computer
Search engine is the website you visit that searches the web for you
Here are some of the popular browsers:
- Microsoft Edge
- Google Chrome
- Safari
?
Here are some the popular search engines
- Google
- Bing
- DuckDuckGo
that's a browser
I have never seen "zoomer doesn't know browser != search engine" in the wild. Fascinating.
yes.
how long this gonna take
Very good, progress
Now, as for your original question.
I assume you have no knowledge of C# yet; thus, you will have to learn a bit before you can accomplish your goal.
However, if you do a bit of googling (you won't be able to escape doing your own research!!!), you'll find that displaying different text by pressing a spacebar shouldn't be too difficult
Keep in mind - there isn't a tutorial for everything. I doubt there is a specific tutorial for what you want
ive been trying to do some form of coding at my high school, but all they got is the block coding
aight
You will have to find bits and pieces of information on the internet and figure it out on your own
(which is an important skill to develop anyway)
To guide you a bit more - here is the path you could take to do what you want:
- learn about WinForms
- Try placing a control for displaying text
- Place a button
- Make the text change when pressing the button
- Figure out how to check if the space bar is pressed
- Change your text when the space bar is pressed
i mean you could do what he wants in a console application too
uhhh no, don't do WinForms first
also, are we still telling people to use winforms
Console is king π
Idk, I see it as an easy starting point for beginners who want to see things happening on the screen and are discouraged by the classic console
Trying to learn a framework before language basics? Yuck...
Yup, I agree
I recommend WPF later, so that they learn to use it correctly from the get go
but yeah, fair point, it is possible with a console
......
So let's analyze your current code. Do you know what WriteLine and ReadKey does?
write line makes the words apear
Yup
and the readkey makes it so the window dosent close
That's actually a side effect of what it really does
what do you think readkey does based on its name?
https://learn.microsoft.com/hu-hu/dotnet/api/system.console.readkey?view=net-7.0
There's documentation
reads the key
Obtains the next character or function key pressed by the user.I highly suggest you search for the documentation when you don't know what a function does It will get you far in programming
aight ty
Most of the things in MS docs also provide an example code.
Is there a specific reason to start with it and not with all basic things in console?
winforms is oldβ’οΈ
you could use it as a learning tool but you shouldn't make any real software with it anymore
how do i get this shit to run
wheres the terminal
oh nvm
Stop renaming namespaces coding terms
It will cause you problems
C# syntax is case sensitive
I remeber that I was also doing those stupid things like naming my project Program and having issues
bruh im a changed human
but now i have a bogger question
how would i make x = multiply?
if i wanted a calculator that can do all the calculator stuff
Show your actual code
Create a method Multiply() which uses parameters if you learned that
nope
thats why im asking
i started learning today
well yesterday, but just how to print one line of text
so can u show me the code
you can multiply 2 numbers with
*
no
how do i make it so if u put in "x" it multiplies
but if i put in "+" it adds
and how do i make the "Input a number" code repeat
you'll need to look into if statements and while loops
Aren t methods a better option? @Jimmacle
for trivial multiplication? definitely not
use operators when they exist
methods are important but unnecessary for what he's working on right now
But the if statements will take some time
When you just could create that method
Public decimal Multiply(int a, int b)
{
Decimal total;
total = a Γ b;
Return total;
}
can i ask you what that actually accomplishes?
you're just doing
a * b
with a) extra steps and b) receiving and returning the wrong types
it also doesn't remove the need for if statements
if your program needs to make a decision you need some kind of conditionalJust use switches and ternary everywhere (this is a joke)
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.