Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Line 35

Posted on 2012-03-24
7
Medium Priority
?
480 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
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…

636 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