Click here to Skip to main content
15,888,202 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
im getting errors
im getting the text as the error in thelast line of code pls help me ??

What I have tried:

<pre>namespace calci_2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Double rv = 0;
        string convoye = "";
        
        public MainWindow()
        {
            InitializeComponent();
        }

        private void but_7(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("7");
        }

        private void but_1(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("1");
        }

        private void button_2(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("2");
        }

        private void button_3(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("3");
        }

        private void button_4(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("4");
        }

        private void button_5(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("5");
        }

        private void button_6(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("6");
        }

        private void button_8(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("8");
        }

        private void button_9(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("9");
        }

        private void button_0(object sender, RoutedEventArgs e)
        {
            text_box__calculator.Text = text_box__calculator.Text + ("0");
        }

        private void operater_click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            convoye = button.Text;
            rv = Double.Parse(text_box__calculator.Text);
        }
    }
}
C#

Posted
Updated 13-Dec-20 18:46pm
Comments
Patrice T 14-Dec-20 0:43am    
Try to show error messages.
Dave Kreskowiak 14-Dec-20 1:54am    
Why is it every noob thinks the error messages are not important? They are THE MOST IMPORTANT piece of information needed to solve a problem!

1 solution

(XAML) Buttons don't have a .Text property; what they have is an object in the .Content property; be it a string, image, shape, etc.

In other words, you cast from .Content for a button.
 
Share this answer
 
Comments
ꜱɑı ꜱɑռɖΞꜱɦ 15-Dec-20 5:14am    
it did not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900