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 DePosted Dec 17, 2010, 2:08 PM
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.....
Suthish NairPosted Dec 18, 2010, 4:24 AM
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.
Sam HobbsPosted Dec 18, 2010, 3:05 AM
John BurnsPosted Dec 18, 2010, 2:38 AM
Generally it converts the numericDown1.value to int datatype.
Thanks.....
John BurnsPosted Dec 18, 2010, 2:22 AM
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?
Sam HobbsPosted Dec 17, 2010, 8:50 PM
John BurnsPosted Dec 17, 2010, 2:05 PM
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?
Suthish NairPosted Dec 17, 2010, 1:58 PM
For more refer msdn, msdn
John BurnsPosted Dec 17, 2010, 1:54 PM
Subhendu DePosted Dec 17, 2010, 1:52 PM
Generally it converts the numericDown1.value to int datatype.
Thanks.....