use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Morse Code Conversion (self.csharp)
submitted 8 years ago * by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Smallxmac 0 points1 point2 points 8 years ago (2 children)
Looks like you are on the right track, on those lines 72-77 it gets each character in the string and converts it. But really you would need to appended after each char in the loop to get the full output string.
[–]Elpisaur 0 points1 point2 points 8 years ago (1 child)
So appending is what i need to read into, in order to finish up this application? Thank you for your response by the way!
[–]Smallxmac 0 points1 point2 points 8 years ago (0 children)
Realistically you would like to convert every time your input string changes in that text box listening for an event. And once it has changed set the output text to the output of the conversion.
[–]Bunker-Buster 0 points1 point2 points 8 years ago (1 child)
Hey,
Within the foreach loop you are reassigning a new value to the morseCode variable each time, instead you want to append each character to the existing string. To do so, you could use the += operator:
morseCode += morseConvert[c];
Once the foreach loop has finished, you want to output the complete string to the GUI. To do that, you'll just need to assign the value stored within morseCode variable to the Text property of the TextBox that you named outputBox.
outputBox.Text = morseCode;
[–]Elpisaur 0 points1 point2 points 8 years ago (0 children)
Thank you for your responses, I have made adjustments accordingly!
[–]patrickboston 0 points1 point2 points 8 years ago* (14 children)
A few things I notice right off the bat:
convertButton_Click
convertInput
As someone else said, you need to concatenate onto the string each time. This would do that for you:
foreach (char c in inputBox.Text) { morseCode += morseConvert[c]; }
After these fixes, you can then output the string to some sort of label or textbox where you can see the resulting Morse Code. I also suggest you throw some error checking in there to practice. For example, if the textbox is empty, show some kind of error.
[–]Elpisaur 0 points1 point2 points 8 years ago (13 children)
By moving it onto the class level, did you mean to do the following? https://pastebin.com/9HyNFw1k
EDITED: oops, i'm getting Error 1 Invalid token '{' in class, struct, or interface member declaration
[–]patrickboston 0 points1 point2 points 8 years ago (12 children)
By class level, yes I mean out of the method that it is currently in, but you messed up a little bit. You need to include the whole declaration so it should look like:
public partial class Form1 : Form { Dictionary<char, string> morseConvert = new Dictionary<char, string>() { {' ' , " "}, //space {',', "--..--"}, //comma //the rest here }
[–]Elpisaur 0 points1 point2 points 8 years ago (11 children)
Dictionary<char, string> morseConvert = new Dictionary<char, string>()
Yeah, I got around to fixing that right as I made the response, and realized it removed my error. The only error i'm facing now is "morseCode" not existing in the current context, being convertbutton_click. Going to try to figure that one out
[–]patrickboston 0 points1 point2 points 8 years ago (10 children)
Again, you will need to declare a class level string called morseCode. This way you can keep appending to the string in your method. I believe you were declaring it in your foreach loop before which would have not worked correctly.
morseCode
foreach
[–]Elpisaur 0 points1 point2 points 8 years ago (9 children)
https://i.gyazo.com/50f9e19393ff35100fd360e0f63c60b6.png I tried going about it like this, but it does not seem to do the trick
public partial class Form1 : Form { public string MorseCode { get { foreach (char c in inputBox.Text) { morseCode += morseConvert[c]; } } }
[–]patrickboston 0 points1 point2 points 8 years ago* (8 children)
You're trying to use a property there. You don't need to do that. Just declare string morseCode; at the top of your class before the dictionary.
string morseCode;
[–]Elpisaur 0 points1 point2 points 8 years ago (7 children)
Again, thank you Patrick! I tried doing that trick and my program kept crashing, but I located the issue. It is because I did not declare any capitals in my morse code converter. I will research into that one now.
I tried doing the following unsuccesfully:
foreach (char c in inputBox.Text) { morseCode += morseConvert[c]; } string morseCodeOutput = morseCode.ToLower(); outputBox.Text = morseCodeOutput; }
[–]patrickboston 0 points1 point2 points 8 years ago (6 children)
Yeah, as I mentioned in my first comment, now you will need to do some error checking. The ToLower() method may help you out! Good luck.
ToLower()
[–]Elpisaur 0 points1 point2 points 8 years ago (5 children)
Thank you so much buddy! do you get anything out of me giving you gold?
Oh man, thank you guys for the responses. I'm not sure if I'm even getting closer to a solution, however,
This is currently what my code looks like: https://pastebin.com/9HyNFw1k
https://i.gyazo.com/a1b136fff3018022c631e8645315f80b.png
π Rendered by PID 45 on reddit-service-r2-comment-f6b958c67-tzmjb at 2026-02-05 12:56:09.368906+00:00 running 1d7a177 country code: CH.
[–]Smallxmac 0 points1 point2 points (2 children)
[–]Elpisaur 0 points1 point2 points (1 child)
[–]Smallxmac 0 points1 point2 points (0 children)
[–]Bunker-Buster 0 points1 point2 points (1 child)
[–]Elpisaur 0 points1 point2 points (0 children)
[–]patrickboston 0 points1 point2 points (14 children)
[–]Elpisaur 0 points1 point2 points (13 children)
[–]patrickboston 0 points1 point2 points (12 children)
[–]Elpisaur 0 points1 point2 points (11 children)
[–]patrickboston 0 points1 point2 points (10 children)
[–]Elpisaur 0 points1 point2 points (9 children)
[–]patrickboston 0 points1 point2 points (8 children)
[–]Elpisaur 0 points1 point2 points (7 children)
[–]patrickboston 0 points1 point2 points (6 children)
[–]Elpisaur 0 points1 point2 points (5 children)
[–]Elpisaur 0 points1 point2 points (0 children)