?
Solved

Line 35

Posted on 2012-03-24
7
Medium Priority
?
479 Views
Last Modified: 2012-03-26
This is the error that I am recieving. Can you help me.  I am a student needing tutoring and guidance.  The following errror is the problem in my program on line 35

Error      1      Property or indexer 'string.this[int]' cannot be assigned to -- it is read only      C:\Users\acer\Documents\TitleCase\Default.aspx      35      25      C:\...\TitleCase\

This is what I am trying to accomplish.

I must create a script that takes text that a user enters into a form field and converts it to title case capitalization.  Use a split()  method to split words in the string into an indexed array.  Then create a for loop that uses another split() method that splits each word in the elements of the indexed array into another another indexed array of characters.  Within the for loop, us he ToUpper() method to convert the first element in the second array (which represents the first characters in the word to uppercase) to uppercase, and then use the Join() method to rebuild the array of words in the text string.  Execute a final Join() method to convert the array of words back into a single text strin.  Save the project as TitleCase
TitleCase.zip
0
Comment
Question by:assaultkitty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 37761584
Can you post your code?
Default.aspx.cs does not contain any code:
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
0
 

Author Comment

by:assaultkitty
ID: 37761614
No, i do not have any code in it!  I am not using it.  Do I need to use it.  If so, then where do I start.  I got the HTML code to show.  Can you help?
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 37761911
No, i do not have any code in it!  I am not using it.  Do I need to use it.  If so, then where do I start.  I got the HTML code to show.  Can you help?


Show default.aspx as starting page and declare textbox in default.aspx page. And in Default.aspx.cs file, write code in button submit event hander as follow:

Code in .aspx.cs file:
string value = TextBox1.Text;
string upperValue = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value);

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Accepted Solution

by:
Navneet earned 2000 total points
ID: 37762170
Hi!

Create Extension method with vs00asini in codebehind
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

 
}

public static class myString
{
    public static string ToTitleCase(this string Input)
    {
        return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Input.ToLower());
    }

}

Open in new window


And use it in your HTML file

enteredText = enteredText.ToTitleCase();

Open in new window


Thanks!
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 37762494
Comment ID: 37762491 at link Line 33 would be the reason and solution for this problem too.
0
 

Author Comment

by:assaultkitty
ID: 37768698
I have to really trust the experts.  I did excellent on this project.   Thank you!
0
 

Author Closing Comment

by:assaultkitty
ID: 37768702
Thanks so much!
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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