How to format for needed information

Posted on 2006-04-27
Last Modified: 2008-01-09
I am trying to perform a simple process in Visual Studio 2005 (Visual Basic & 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
Question by:psmithphil
    LVL 17

    Expert Comment

    in what line you'r getting the error?

    Author Comment

    I get it whenever I execute either of the textbox.text lines (I comment out the first so I can run the second line).
    LVL 23

    Accepted Solution

    Try this..

    Dim Site As SPSite = WebControls.SPControl.GetContextSite(HttpContext.Current)
    Dim Web As SPWeb = WebControls.SPControl.GetContextWeb(HttpContext.Current)
    LVL 37

    Assisted Solution

    ...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 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...
    LVL 23

    Expert Comment

    You can ignore my last comment if those lines are working for you..

    What is Web? Is it some variable?

    Author Comment

    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.

    Author Comment

    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!

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now