• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 434
  • Last Modified:

How to format for needed information

I am trying to perform a simple process in Visual Studio 2005 (Visual Basic & asp.net) but I get the following error:
"Input string was not in a correct format."

The textboxes should simply give some basic information, but I guess I don’t know how to format these things.

If I look in the error details I see this additional information:
“In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user”

Can you spot where I’m missing it?

Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.SPWeb

Dim Site As SPSite = WebControls.SPControl.GetContextSite(Context)
Dim Web As SPWeb = WebControls.SPControl.GetContextWeb(Context)

TextBox1.Text = Web.Created.Date.DayOfYear.ToString
TextBox2.Text = Web.Title.Length.ToString
2 Solutions
Elvio Lujan.Net Senior DeveloperCommented:
in what line you'r getting the error?
psmithphilAuthor Commented:
I get it whenever I execute either of the textbox.text lines (I comment out the first so I can run the second line).
Try this..

Dim Site As SPSite = WebControls.SPControl.GetContextSite(HttpContext.Current)
Dim Web As SPWeb = WebControls.SPControl.GetContextWeb(HttpContext.Current)
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

...I don't think the problem is happening when you assign text to the textboxes...
...I think it's happening in the 2 lines above it..

Dim Site As SPSite = WebControls.SPControl.GetContextSite(Context)
Dim Web As SPWeb = WebControls.SPControl.GetContextWeb(Context)

Where/how is "Context" defined?
I bet this is more a sharepoint thing than a vb.net thing

you can do: textbox.text = Just_About_Any_Object.ToString
And almost always get back some kind of information....

see if you can find more info about the "GetContext...(param)" functions in Sharepoint documentation, Google, or post to Sharepoint T/A...
You can ignore my last comment if those lines are working for you..

What is Web? Is it some variable?
psmithphilAuthor Commented:
So maybe it's an issue that I'm not passing the Context anything.  I need to see what I need to do to pass a url to it perhaps.  I will look at this so that I can give you better information.  I'm obviously not understanding the overall process.
psmithphilAuthor Commented:
It doesn't look like I'm going to figure this out anytime soon.  You've given me some ideas to look at and therefore I'll split the points.

Thank you for your help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now