I am trying understand what the CType function does. The book introduces it on the FanClub.aspx page where user profiles are created & modified.
The sample line is quoted:
Code:
Profile.Name = CType(FCLoginView.FindControl("txtName"), TextBox).Text
And the explanation is given:
Find me the control called txtName...treat it like a TextBox control, then grab the data stored in its Text property and use that value to store in the profile.
This explanation raises more questions for me:
1) The phrase "treat it like a TextBox control" suggests that it's actually something else, but in fact it
is a textbox control, so why ...?
2) Why not use something like
Code:
Profile.Name = FCLoginView.txtName.Text
3) Why is it necessary to use CType?
4) Why is it necessary to
find a control?
Richard
Rugeley, UK
WinXP Pro SP2
VBW Express + SQL Server 2005 Express