Page 90 Second Edition
2 replies to this topic
Posted 01 August 2012 - 07:44 AM
Hi everyone. I am going through the book, still in the begining
Few questions on code on page 90 (step 3)
1) Why do we have int inside parenthesis? I tried not to put them and the code didn't work what's the significance?
2) Why do we get the legth of the code? len is just a variable, you could write "c" instead of len and the code would work? textbox1.text I thought stands for the text in the textbox not it's length.
Posted 01 August 2012 - 09:36 AM
I figured out where the length is coming from, it's from the BlahBlahBlah() return statement. So that second point in my post is resolved. The first one's still open.
Posted 03 August 2012 - 09:56 PM
The answer to the (int) question comes about 40 pages later. It's called "casting." Since the Value property returns a decimal, and your BlahBlahBlah method needs an int to work property, doing (int)numericUpDown1.Value will convert the decimal value to an int so that your BlahBlahBlah method can use it.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users