Can't Figure Out Correct Syntax

W

Wayne Wengert

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/archive/2005/10/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.UserName, 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.ContentTemplateContainer.FindControl("rblSex"),
RadioButton)).Text

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

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

p.Save()

End Sub
 
T

tomb

Wayne said:
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/archive/2005/10/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.UserName, 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.ContentTemplateContainer.FindControl("rblSex"),
RadioButton)).Text

p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.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").Text)))

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

Tom
 
W

Wayne Wengert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top