Type: Posts; User: Jim_Auricman
Search took 0.01 seconds.
November 10th, 2015, 05:09 PM
If you want it to recognize names not only 'Will', but containing "Will", like "Willster", etc., you can use 'Contain' rather than '=='.
November 9th, 2015, 09:29 AM
You can pass parameters by reference; that way you can declare the variable in the calling function and pass this same variable into both methods.
public static void function(ref double x)
October 24th, 2015, 04:57 PM
The way I do this in Visual Studio is to save a template of the project I want to copy, then close the project and create a new project, importing the template of the old project, using a different...
October 10th, 2015, 09:14 AM
Yes, you could pass the array size into the method as a value parameter.
Loop as long as i < the array length, not i<= array length.
To display the contents of the array, start with this line, then...
October 9th, 2015, 10:23 PM
I see several problems with your method. In your 'for' loop, you are exceeding the bounds of the array. You are looping until i <= Array.Length; When you start with i = 0, you should run as long as i...
October 1st, 2015, 11:34 PM
October 1st, 2015, 11:20 PM
Yes, exactly. Look at the example that I posted. The Main method declares the variables and passes them into the method that does something with them and returns them.
October 1st, 2015, 11:10 PM
Here is an example of a function (method) which uses reference Parameters:
static void Get_Numbers(ref double D1, ref double D2, ref bool Success)
// Practice of a function using...
October 1st, 2015, 10:50 PM
You could display the result within the method instead of returning the result, but by returning it, the method is more generic thus being more useful than only displaying it when you calculate it....
September 30th, 2015, 05:05 PM
The Math function is returning an integer, but you are not displaying it.
Try adding code to display the result in Main before Console.ReadKey();, something like this:
September 29th, 2015, 11:48 AM
I usually prefer 'while' loops that exit when a flag is set, indicating that certain conditions have been met. For example,
// do whatever needs to be done;
// When condition(s)...
September 28th, 2015, 04:56 PM
The function is: private void button1_Click(object sender, EventArgs e)
Outside the 'for' loop, add: label4.Text = "Value of i where there was a match, is ";
Then inside the place where "if (die1...
September 28th, 2015, 04:16 PM
You won't see the display until the function exits.
Using the debugger, I saw that the dies matched 16 times. Of course, each time the results may vary. If you execute label3.Text = ""; and...
September 20th, 2015, 02:10 PM
static void Main(string args)
TestIfElse(10);-----------------------------------------------------------Why do I need the (10) here is I am declaring what numbers I am comparing to n in my next...
September 20th, 2015, 01:50 PM
Yes, in Main 'n' isn't declared anywhere.
I think your instructor wanted you to put the logic that you have in Main into the method that you created.
September 20th, 2015, 01:45 PM
You will find that using methods instead of writing in-line code for everything you want to do is much easier to understand & follow, especially if someone else wrote the code and you are trying to...
September 20th, 2015, 01:26 PM
September 19th, 2015, 08:28 PM
"I do not understand how you can add a second Method to the same class? "
Take a look at the thread "Newb trying to learn C# / stuck".
The sample program I added to the thread has several methods...
September 18th, 2015, 04:18 PM
It would be good if you would forget about using 'goto' if you want to write good code.
I have rewritten your program to use functions instead of 'goto's.
April 23rd, 2015, 10:02 PM
Thanks, Arjay. I'll check into using a post build event, as that might be useful to do in some cases.
April 23rd, 2015, 01:36 PM
Thanks for your responses.
Each project has its own BIN directory. Using a Utility directory whose path is in the environment allows access more easily than specifying each project's BIN path when...
April 23rd, 2015, 10:44 AM
That's exactly what I do; The disadvantage is that when a new version of a Console application is made, the new version has to be re-copied to the utility folder.
"Utility folder that has a public...
April 23rd, 2015, 08:12 AM
The problem with using a shortcut to access a console application is that inputting parameters is problematic.
You can use Console.ReadLine() to input the parameters, but if you have 3 or 4...
April 22nd, 2015, 02:10 PM
I develop both Windows Forms and Console applications in C#.
The forms applications are easy to access by creating a shortcut on the desktop pointing to the executable file in one of the BIN...
July 17th, 2012, 04:17 PM
Coding standards were developed because frequently someone else will have to maintain your code, and having the code work will not necessarily make it understandable and maintainable. Using "break"...
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!