Click here to Skip to main content
15,905,414 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Fill comboBox with DB content Pin
Anna King3-Jun-13 2:47
professionalAnna King3-Jun-13 2:47 
AnswerRe: C# Fill comboBox with DB content Pin
BobJanova3-Jun-13 4:12
BobJanova3-Jun-13 4:12 
GeneralRe: C# Fill comboBox with DB content Pin
tizziCerutti10-Jun-13 21:55
tizziCerutti10-Jun-13 21:55 
AnswerRe: C# Fill comboBox with DB content Pin
Amol_B4-Jun-13 19:41
professionalAmol_B4-Jun-13 19:41 
Question[Solved] Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta1-Jun-13 3:18
AlphaDeltaTheta1-Jun-13 3:18 
AnswerRe: Binding to data that will be resloved asyncronously Pin
Abhinav S1-Jun-13 7:35
Abhinav S1-Jun-13 7:35 
GeneralRe: Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta1-Jun-13 15:22
AlphaDeltaTheta1-Jun-13 15:22 
AnswerRe: Binding to data that will be resloved asyncronously Pin
Anna King3-Jun-13 2:55
professionalAnna King3-Jun-13 2:55 
AnswerRe: Binding to data that will be resloved asyncronously Pin
BobJanova3-Jun-13 4:14
BobJanova3-Jun-13 4:14 
GeneralRe: Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta3-Jun-13 17:15
AlphaDeltaTheta3-Jun-13 17:15 
QuestionC# Project On Image Processing Pin
Bishwajit Nepali31-May-13 23:47
Bishwajit Nepali31-May-13 23:47 
AnswerRe: C# Project On Image Processing Pin
Eddy Vluggen1-Jun-13 11:05
professionalEddy Vluggen1-Jun-13 11:05 
GeneralRe: C# Project On Image Processing Pin
Bishwajit Nepali24-Sep-13 8:29
Bishwajit Nepali24-Sep-13 8:29 
AnswerRe: C# Project On Image Processing Pin
Anna King3-Jun-13 3:00
professionalAnna King3-Jun-13 3:00 
AnswerRe: C# Project On Image Processing Pin
Pete O'Hanlon3-Jun-13 3:23
mvePete O'Hanlon3-Jun-13 3:23 
AnswerRe: C# Project On Image Processing Pin
Bishwajit Nepali3-Jun-13 6:12
Bishwajit Nepali3-Jun-13 6:12 
GeneralPracticing Passing Parameters Pin
N8tiv31-May-13 16:25
N8tiv31-May-13 16:25 
GeneralRe: Practicing Passing Parameters Pin
OriginalGriff31-May-13 21:15
mveOriginalGriff31-May-13 21:15 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 7:19
N8tiv3-Jun-13 7:19 
GeneralRe: Practicing Passing Parameters Pin
OriginalGriff3-Jun-13 7:59
mveOriginalGriff3-Jun-13 7:59 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan31-May-13 23:21
mveRichard MacCutchan31-May-13 23:21 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 1:02
N8tiv3-Jun-13 1:02 
Both you and the book lost me… You both are saying the same thing, but…

Here is the whole chapter, so you can see what they're talking about and maybe why I'm lost.

4-8 Using Program Arguments

One possible form of the Main method is:
static void Main(string[] args)

Using this form allows the C# program to accept as arguments a sequence
of strings. The arguments are received as string array elements named
args[0], args[1], and so forth. The string arguments can also be converted
to other data types, as explained in Chapter 3.

In the following example, the program receives two arguments at run
time. The program converts the first one to a long number and the second
to a double number, and then displays them and their product.

C#
Example 4-11
// Example 4-11.cs
// Parsing arguments
using System;
public class ParseClass
{
static void Main(string[] args)
{
long myLong = Convert.ToInt64(args[0]);
double myDouble = Convert.ToDouble(args[1]);
double result = myLong * myDouble;
Console.WriteLine("Your long number is: {0}", myLong);
Console.WriteLine("Your double number is: {0}", myDouble);
Console.WriteLine("The result of multiplication is: {0}",
result);
}
}


Sample Run:
Assuming that the program is called “example,” enter the following at the
command line:
> example 2 1.1

The output should be:

Your long number is: 2
Your double number is: 1.1
The result of multiplication is: 2.2

Drill 4-4
Rewrite the program created for Drill 4-2 to read the number and the
power as program arguments. For example, if the program is called
“power,” you can invoke it as shown in these sample runs:

Sample Run 1:
>power 4 2
The number 4 raised to the power 2 = 16
Sample Run 2:
>power 4 3
The number 4 raised to the power 3 = 64



Here is my code, it's basically the same as yours… Just the names of the variables are changed.
C#
using System;

namespace PracticePassingParameters
{
    class Program
    {
        static void Main(string[] args)
        {
            int FN = Convert.ToInt32(args[0]);
            int SN = Convert.ToInt32(args[1]);
            Console.Write(Math.Pow(FN, SN));
            Console.Read();
        }
    }
}


When I run it in the debugger, "index was outside the bounds of the array"… WTHConfused | :confused:

GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 1:20
mveRichard MacCutchan3-Jun-13 1:20 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 2:39
N8tiv3-Jun-13 2:39 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 6:15
mveRichard MacCutchan3-Jun-13 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.