hi i'm a vb.net programmer trying to learn C# for now.
Let me ask you about simple questions in C#

How do you do this in C#?

this is a vb.net code:

TextBox1.Text = 1

try,

TextBox1.Text="1";

why does it need to include two quotation marks?

Because the Text property of TextBox is of type string and not of type integer.
C# is very picky about this, and as a matter of fact this is one of the things I like about C# :)
Alternatively you could write: TextBox1.Text = 1.ToString();

This thread made me lol

Thanks for the replies.. How about if i wanted to delete the last text input in the textbox say for example the characters inside the textbox is: LATER. I want to remove the last letter R. How will i do this in C#?

Learn and use String class methods.

Thanks for the replies.. How about if i wanted to delete the last text input in the textbox say for example the characters inside the textbox is: LATER. I want to remove the last letter R. How will i do this in C#?

Think about how you would do it in vb.net.... C# and VB.Net are built on the same framework, and have the same class hierarchy. The actual differences between the languages are very few, and mostly syntactical. One of the only legitimate differences is the ability to use pointers in an unsafe context in c# (even though this is still possible in vb.net via win32 api calls).

since the textbox is of type string, u can use the string class to manipulate and play with the values of a textbox, check for Replace(), SubString() or Remove() methods of the string class.

i tried this to no avail..

txtDisplay.Text = txtDisplay.Text.Remove((txtDisplay.Text.Length - 1), 1);

i have already solved the problem! THanks for your help guys!~ God bless you all

string strng;
int location;
if (txtDisplay.Text.Length > 0)
{
strng = txtDisplay.Text.Substring(txtDisplay.Text.Length - 1);
                if (strng == ".")
               {                  
               }
               location = txtDisplay.Text.Length;
               txtDisplay.Text = txtDisplay.Text.Remove(location - 1, 1);
            }

if u have to remove the last character, you can use Substring() method

txtDisplay.Text = "123456";

txtDisplay.Text = txtDisplay.Text.Substring(0, txtDisplay.Text.Length - 1);
//now the text becomes "12345"

or:

txtDisplay.Text = txtDisplay.Text.Remove(txtDisplay.Text.Length - 1);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.