Solved

Line 35

Posted on 2012-03-24
7
474 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
7 Comments
 
LVL 35

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 15

Accepted Solution

by:
navneethegde earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

778 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