❔ 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
Denis
Denisβ€’2y ago
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?
Denis
Denisβ€’2y ago
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?
Thinker
Thinkerβ€’2y ago
They probably just have a console app
π’»π“‡π‘’π’Άπ“€π“Ž
nope ive created only the very basic text
Denis
Denisβ€’2y ago
nice, but where did you create it? Could you share a screenshot of where you placed the text?
Denis
Denisβ€’2y ago
Ah, you are using Visual studio code Are you following a youtube tutorial?
π’»π“‡π‘’π’Άπ“€π“Ž
idk any good ones you got any links?
Thinker
Thinkerβ€’2y ago
$helloworld
Denis
Denisβ€’2y ago
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
Denis
Denisβ€’2y ago
Please download Visual Studio Community Edition 2022
Thinker
Thinkerβ€’2y ago
Visual Studio Community 2022 is a far more fully-featured and beginner-friendly editor than VSCode
Denis
Denisβ€’2y ago
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
Pobiega
Pobiegaβ€’2y ago
Google? Don't expect to be handfed everything
π’»π“‡π‘’π’Άπ“€π“Ž
D: i have a different google
Denis
Denisβ€’2y ago
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
Denis
Denisβ€’2y ago
That is a browser not a search engine
π’»π“‡π‘’π’Άπ“€π“Ž
whats the difference
Pobiega
Pobiegaβ€’2y ago
You for real?
Denis
Denisβ€’2y ago
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"
Denis
Denisβ€’2y ago
well, sorry to break to you, it is different.
Pobiega
Pobiegaβ€’2y ago
Browser is the program on your computer Search engine is the website you visit that searches the web for you
Denis
Denisβ€’2y ago
Here are some of the popular browsers: - Microsoft Edge - Google Chrome - Safari
Denis
Denisβ€’2y ago
Here are some the popular search engines - Google - Bing - DuckDuckGo that's a browser
hiyosilver
hiyosilverβ€’2y ago
I have never seen "zoomer doesn't know browser != search engine" in the wild. Fascinating.
π’»π“‡π‘’π’Άπ“€π“Ž
how long this gonna take
Denis
Denisβ€’2y ago
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
Denis
Denisβ€’2y ago
You will have to find bits and pieces of information on the internet and figure it out on your own
Jimmacle
Jimmacleβ€’2y ago
(which is an important skill to develop anyway)
Denis
Denisβ€’2y ago
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
Jimmacle
Jimmacleβ€’2y ago
i mean you could do what he wants in a console application too
Thinker
Thinkerβ€’2y ago
uhhh no, don't do WinForms first
Jimmacle
Jimmacleβ€’2y ago
also, are we still telling people to use winforms
Pobiega
Pobiegaβ€’2y ago
Console is king πŸ™‚
Denis
Denisβ€’2y ago
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
hiyosilver
hiyosilverβ€’2y ago
Trying to learn a framework before language basics? Yuck...
Pobiega
Pobiegaβ€’2y ago
Yup, I agree
Denis
Denisβ€’2y ago
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
Pobiega
Pobiegaβ€’2y ago
So let's analyze your current code. Do you know what WriteLine and ReadKey does?
π’»π“‡π‘’π’Άπ“€π“Ž
write line makes the words apear
Pobiega
Pobiegaβ€’2y ago
Yup
π’»π“‡π‘’π’Άπ“€π“Ž
and the readkey makes it so the window dosent close
Pobiega
Pobiegaβ€’2y ago
That's actually a side effect of what it really does
Jimmacle
Jimmacleβ€’2y ago
what do you think readkey does based on its name?
Buddy
Buddyβ€’2y ago
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
Buddy
Buddyβ€’2y ago
Most of the things in MS docs also provide an example code.
Preda
Predaβ€’2y ago
Is there a specific reason to start with it and not with all basic things in console?
Jimmacle
Jimmacleβ€’2y ago
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
Preda
Predaβ€’2y ago
Stop renaming namespaces coding terms It will cause you problems
Jimmacle
Jimmacleβ€’2y ago
C# syntax is case sensitive
Preda
Predaβ€’2y ago
I remeber that I was also doing those stupid things like naming my project Program and having issues whenharold
π’»π“‡π‘’π’Άπ“€π“Ž
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
Preda
Predaβ€’2y ago
Show your actual code
Preda
Predaβ€’2y ago
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
Jimmacle
Jimmacleβ€’2y ago
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
Jimmacle
Jimmacleβ€’2y ago
you'll need to look into if statements and while loops
Preda
Predaβ€’2y ago
Aren t methods a better option? @Jimmacle
Jimmacle
Jimmacleβ€’2y ago
for trivial multiplication? definitely not use operators when they exist methods are important but unnecessary for what he's working on right now
Preda
Predaβ€’2y ago
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; }
Jimmacle
Jimmacleβ€’2y ago
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 conditional
Kouhai
Kouhaiβ€’2y ago
Just use switches and ternary everywhere Smile (this is a joke)
Accord
Accordβ€’2y ago
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.

Did you find this page helpful?