Cannot implicitly convert type 'int' to 'string' - NEED HELP

csharp Saudi Arabia
  • 10 years ago

    I don't do web programming, but I think the problem lies in:


    DocumentIDValue.Text = 1;




    DocumentIDValue.Text = "1";


    Hope this helps.

  • 9 years ago

    Text is a property of Textbox which accepts only string type value.

    So, if you want to store a numeric value in Text of a TextBox you should write -

    TextBox.Text = 1.ToString();

    If you want to get Text of a TextBox in a int variable you should write -

    int i = convert.ToInt32(TextBox1.Text);

  • 9 years ago


       if u go that error , so u can now caonvert it into string......

     Ex :

      int i= 65;

      textBox1.Text = i.ToString(); ----->>> menas here u r converting i value 65 into string




  • 9 years ago

    Yes, you are right. I am converting an integer variable to a string variable. Just like 65 to "65". Because TextBox only accepts string type of value as Text.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks