Jump to content


Photo

Page 90 Second Edition


  • Please log in to reply
2 replies to this topic

#1 shriner11

shriner11

    New Member

  • Members
  • Pip
  • 2 posts

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.

#2 shriner11

shriner11

    New Member

  • Members
  • Pip
  • 2 posts

Posted 01 August 2012 - 09:36 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.



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.

#3 mmcanelly

mmcanelly

    New Member

  • Members
  • Pip
  • 4 posts

Posted 03 August 2012 - 09:56 PM

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.


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