Thank you. My mentor wants me to allow the user another chance if he/she enters a number that is too large or enters letters instead of number. This is quite a learning experience. Thank you for your help. Deborah
Deborah Palmer McCain
Posts
-
C# Limit number of characters user can enter - Console Application -
C# Limit number of characters user can enter - Console ApplicationThank you so much. This helps a great deal.
-
C# Limit number of characters user can enter - Console ApplicationI suspect my mentor is attempting to reduce me to girlie tears. I am to take my basic multiplication code and restrict the number of characters a user can enter (in order to avoid an overload) After searching stackoverflow and Google, I can only find tutorials for textboxes but not working with console applications...or am I simply dim (stop laughing).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace debprojectC
{
class Program
{
static void Main(string[] args)
{
int number1, number2;Console.WriteLine("Please enter a number:"); number1 = Int32.Parse(Console.ReadLine()); Console.WriteLine("Please enter another number:"); number2 = Int32.Parse(Console.ReadLine()); int result; result = number1 \* number2; Console.WriteLine("Multiplication:" + result.ToString()); Console.ReadKey(); } }
}
Assistance please. Deborah
-
C#_Error "Namespace cannot directly contain..."Roger: Thank you for the update, I thought that 7 was wreaking havoc with my one lonely desktop. I used Vista (no gagging) with relish for so many years, that the Apple-esque features of 7 cause me to blame it for everything. I do like Stick Notes though. Just as an update, my application runs smoothly after I fixed further code errors Thank you again for your help. Deborah
-
C#_Error "Namespace cannot directly contain..."I wanted to wander back and thank you formally. I changed "product" to "muliply" and it looks like I neglected the "convert to 32" as well as my other errors. Thank you again.
-
C#_Error "Namespace cannot directly contain..."Thank you very much for the guidance. I will make the necessary adjustment in Visual Studio. I appreciate you taking the time to help.
-
C#_Error "Namespace cannot directly contain..."I am having difficulty posting replies. If this is a double, I apologize. Thank you for your assistance. My namespace "name" is a bad habit I must break (from business emails with the date at the beginning of the Subject line). Thank you for the reminder. Also, the braces? I have no excuse for the carelessness.
-
C#_Error "Namespace cannot directly contain..."Thank you for your help. I appreciate your time.
-
C#_Error "Namespace cannot directly contain..."Roger: Thank you. I appreciate your help.
-
C#_Error "Namespace cannot directly contain..."As I am new at this, and this is my first attempt at actually writing code, some of you may chuckle (or laugh out loud at the simplistic code)... please be merciful. I keep getting the error message: A namespace cannot directly contain members such as fields or methods" I have visited MSDN, and virtually every google and bing hit out there, but no matter how I change the first entry, I get the same message. Could someone help?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace _11012_debproject_2
{class Program { static void Main(string\[\] args); int number1; int number2; int Multiply; // prompt user // enter first number
}
Console.WriteLine( "Enter first number:" ) number1 (Console.Readline()); // prompt user // enter second number Console.WriteLine( "Enter second number:") number2 ( Console.ReadLine()); product = number1 \* number2; // multiply numbers Console.WriteLine( "product is {0}",product );
}
// display product} } -
Dan Clark's C# Object-Oriented Programming-Issue with sln filesThank you. I may have missed deleting one of my 9,000 (hyperbole) download attempts.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesThank you for your help. I have a new version of WinZip...so this is obviously a "me" error (how frustrating to be repeatedly "dim" with WinZip files.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesThank you! I was right-clicking...and hopefully there is an arc in my learning curve. I always seem to have trouble with WinZip files.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesSorry for the misstep in not providing the link to the file. I am now able to see the file, but I am missing a step in opening it in VS 2010. I am getting a path error. Thank you for your response.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesThank you. I am not behind a corporate firewall, and the file was sent to me by my mentor, but now I get a path error when I try to open it in VS 2010. But thank you for trying to help. I will solve this, if it takes me...forever...which is likely.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesThank you for your help. I can now see the file (my mentor was able to download and unzip it), and he sent it to me, but now I am getting an error through VS 2010. There is something I am doing wrong. How very irritating to me "limited" right now..
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesI had put the title of the book in the Subject line (I thought that would be easiest, but perhaps I should have put it in the body. My mentor was able to download the code, and send the file, but now I am getting an error through VS that the path cannot be found. I am determined to solve this. Thank you for your help, I truly appreciate it.
-
Dan Clark's C# Object-Oriented Programming-Issue with sln filesAfter several frustrating hours, I thought I would post in the lounge. I am using Clark's book (among others) and beginning with Chapter 6 the author uses VS 2010 (full version). Previous to this I was happily moving along using Express. Anyway, Chapters 6 and 7 have sln files that have to be downloaded from the Apress website. They are WinZip, and for the life of me, (regardless of my forehead thumping) I cannot get the bugger to open. I get the message that it is not a valid archive, and to try downloading it again (I have done this at least 6 times). I have tested other Win Zip files and they open. Could someone tell me if I am doing something idiotic (always a possibility), or if the file is corrupted, and I should just move to Chapter 8 and look for tutorials on Creating Class Methods, and Overloading Methods, elsewhere? I changed Browsers, with still no luck. www.apress.com Thank you in advance.
-
C# help?Yes, I read through part the book, and will be printing it so I can mark it. Truly a valuable resource, thank you again. Deborah
-
C# VS10 and error "no suitable method to override" issueBill: Thank you for your very detailed explanation of choices. As you indicate, cognitive style plays a great part in the resources with which people will be comfortable. It's never a one size fits all. This is one of the difficulties in college classes, where there is an assigned text, which is why I elected not to enroll in a programming class as I prepare to return for my second Master's degree. When I first began learning C#,which appealed to me of all of the languages (probably because it's case sensitive...but who knows) I recognized I am top down in my own thoughts, but because I taught both middle school and adults, lessons had to be presented in a bottom up fashion. When I first began teaching, I was very much top down, and my students crashed and burned. With C#, I have just recently begun to "mess" with code (some of the problems posted here), but am not proficient enough to offer input. I like to see how I can solve the errors I immediately recognize before clicking F5. I have printed your post as a reference for authors. I did go to Amazon and research the authors you had initially recommended, and added them to my wish list. I really need to "discover" if I am a developer. Research is my absolute love, and I was initially hired by my client to be a technical researcher, and then he offered the opportunity of learning to code. I hope I can live in both worlds. You may be interested in the book, Designing with the Mind in Mind by Jeff Johnson. He discusses UI (another passion along with UX), and the book is truly marvelous. Best, Deborah "UberElmR"