just wondering why this arguments data type has parenthesis around it? here is the code. the part in question is in red.
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int length = Talker.BlaBlaBla(textBox1.Text, (int) numericUpDown1.Value);
MessageBox.Show("length is: " + length, "# of times");
}
also, if its any help, here is the class code that goes with it.:
class Talker
{
public static int BlaBlaBla(string thingToSay, int numberOfTimes)
{
string finalString = "";
for (int count = 1; count <= numberOfTimes; count++)
{
finalString = finalString + thingToSay + "\n";
}
MessageBox.Show(finalString, "text to say");
return finalString.Length;
}
Loading

Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 17, 2010, 9:08 AM EST
for(int i=0;i<10; i++) that means loop starts from 0 to 10 incremented by 1. Start and end digit, you specify. your thinking is correct.
Also request you to create new thread for new query.
Thanks.....
Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 17, 2010, 8:52 AM EST
Generally it converts the numericDown1.value to int datatype.
Thanks.....
John Burns116 reputationPosted Dec 17, 2010, 8:54 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 17, 2010, 8:58 AM EST
For more refer msdn, msdn
John Burns116 reputationPosted Dec 17, 2010, 9:05 AM EST
the program is a simple windows user interface with a numerical counter, a textbox and a button. you type a word to the textbox and set the number of times to say and then click the button .... hey presto!
but how does it actually know how many times to loop?
heres what i think, tell me if i am correct:
i run the program, type in a word, setr the numericalUpDown to a number and when i click on the button then arguments i specified in the variable 'length' tells the 'count' in the loop the number of times i want to loop?
Sam HobbsRank #107 · 20.5K reputationPosted Dec 17, 2010, 3:50 PM EST
John Burns116 reputationPosted Dec 17, 2010, 9:22 PM EST
I still dont get what you were getting at? so when i make a post and i get a number of answers i can only check one box to accept an answer or can i select multiple?
John Burns116 reputationPosted Dec 17, 2010, 9:38 PM EST
Generally it converts the numericDown1.value to int datatype.
Thanks.....
Sam HobbsRank #107 · 20.5K reputationPosted Dec 17, 2010, 10:05 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 17, 2010, 11:24 PM EST
Now you asking its an Unboxing or not?
Did you refer the msdn i posted, instead of you accepting above answer.
Its unboxing.
If you need more, msdn.