By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,693 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,693 IT Pros & Developers. It's quick & easy.

Can't Figure Out Correct Syntax

P: n/a
I am trying to code a Sub to store some custom values in a profile for a new
user registration (ASP.NET 2.0 environment). I copied the basic code from an
example I found in a great article
(http://weblogs.asp.net/scottgu/archi...18/427754.aspx ) but one of
my controls is a calendar control - see the p.DOB line in the code - and I
cannot figure out the syntax to use. In the code below, the ", text" at the
end get flagged with the error "Type expected".

If anyone can explain what is expected there I would really appreiate it.

Wayne

================= Code ================
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As
EventArgs)

' Create an empty Profile for the newly created user

Dim p As ProfileCommon =
CType(ProfileCommon.Create(CreateUserWizard1.UserN ame, True), ProfileCommon)

' Populate some Profile properties off of the create user wizard

p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserStep .ContentTemplateContainer.FindControl("calDOB"),
Text)))

p.Sex =
(CType(CreateUserWizard1.CreateUserStep.ContentTem plateContainer.FindControl("rblSex"),
RadioButton)).Text

p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentTem plateContainer.FindControl("HomeState"),
TextBox)).Text

' Save profile - must be done since we explicitly created it

p.Save()

End Sub
Feb 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Wayne Wengert wrote:
I am trying to code a Sub to store some custom values in a profile for a new
user registration (ASP.NET 2.0 environment). I copied the basic code from an
example I found in a great article
(http://weblogs.asp.net/scottgu/archi...18/427754.aspx ) but one of
my controls is a calendar control - see the p.DOB line in the code - and I
cannot figure out the syntax to use. In the code below, the ", text" at the
end get flagged with the error "Type expected".

If anyone can explain what is expected there I would really appreiate it.

Wayne

================= Code ================
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As
EventArgs)

' Create an empty Profile for the newly created user

Dim p As ProfileCommon =
CType(ProfileCommon.Create(CreateUserWizard1.User Name, True), ProfileCommon)

' Populate some Profile properties off of the create user wizard

p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserSte p.ContentTemplateContainer.FindControl("calDOB"),
Text)))

p.Sex =
(CType(CreateUserWizard1.CreateUserStep.ContentTe mplateContainer.FindControl("rblSex"),
RadioButton)).Text

p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentTe mplateContainer.FindControl("HomeState"),
TextBox)).Text

' Save profile - must be done since we explicitly created it

p.Save()

End Sub

Maybe because you're using date.parse, all you need is to change the
comma to a period,

p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserStep .
ContentTemplateContainer.FindControl("calDOB").Tex t)))

I'm only guessing - I don't do asp.net.

Tom
Feb 15 '06 #2

P: n/a
Tom;
I appreciate the suggestion. That doesn't work. It flags the entire line as
"Text is not a member...). What is strange, when I use the "," Intellisense
offers lots of options, including "text"?

Wayne

"tomb" <to**@technetcenter.com> wrote in message
news:Mm*******************@bignews3.bellsouth.net. ..
Wayne Wengert wrote:
I am trying to code a Sub to store some custom values in a profile for a
new user registration (ASP.NET 2.0 environment). I copied the basic code
from an example I found in a great article
(http://weblogs.asp.net/scottgu/archi...18/427754.aspx ) but one
of my controls is a calendar control - see the p.DOB line in the code -
and I cannot figure out the syntax to use. In the code below, the ", text"
at the end get flagged with the error "Type expected".

If anyone can explain what is expected there I would really appreiate it.

Wayne

================= Code ================
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e
As EventArgs)

' Create an empty Profile for the newly created user

Dim p As ProfileCommon =
CType(ProfileCommon.Create(CreateUserWizard1.Use rName, True),
ProfileCommon)

' Populate some Profile properties off of the create user wizard

p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserSt ep.ContentTemplateContainer.FindControl("calDOB"),
Text)))

p.Sex =
(CType(CreateUserWizard1.CreateUserStep.ContentT emplateContainer.FindControl("rblSex"),
RadioButton)).Text

p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentT emplateContainer.FindControl("HomeState"),
TextBox)).Text

' Save profile - must be done since we explicitly created it

p.Save()

End Sub

Maybe because you're using date.parse, all you need is to change the comma
to a period,

p.DOB = Date.Parse((CType(CreateUserWizard1.CreateUserStep .
ContentTemplateContainer.FindControl("calDOB").Tex t)))

I'm only guessing - I don't do asp.net.

Tom

Feb 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.