CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Help Debugging (3.4) - 10/21/12

    I need help debugging this. Can someone help me with this?

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace FixedDebugThree4
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void calculateButton_Click(object sender, EventArgs e)
    {
    int birth;
    int year;
    int age;
    birth = Convert.ToInt32(textBox1.Text);
    year = Convert.ToInt32(textBox2.Text);
    age = year - birth;
    outputLabel.Text = "On your birthday this year, \nyou were or will be " +
    "{0} years old", age;
    }
    }
    }

  2. #2
    Join Date
    Jul 2012
    Posts
    90

    Re: Help Debugging (3.4) - 10/21/12

    You need to change the input to your label's Text property to this...

    Code:
    string.Format("On your birthday this year, \nyou were or will be " + "{0} years old", age)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured