Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:24:06+00:00 2026-05-28T02:24:06+00:00

private void btnMiles_Click(object sender, EventArgs e) { try { int milesless200 = int.Parse(txtMiles.Text); int

  • 0
private void btnMiles_Click(object sender, EventArgs e)
{
    try
    {
        int milesless200 = int.Parse(txtMiles.Text);
        int milesmore200 = int.Parse(txtMiles200.Text);

        MilesCal workingoutmilescost = new MilesCal();
        if (milesless200 > 200)
        {
            lblMilesMorethan200.Text = "You can't enter more then 200 in the first box";
        }
        else
        {
            if (milesmore200 == 0)
            {
                 int carry = workingoutmilescost.MilesRepay(milesless200);
                 lblMilesShow.Text = carry.ToString();

            }
            else
            {
                int carry = workingoutmilescost.MilesRepay(milesless200, milesmore200);
                lblMilesShow.Text = carry.ToString();
            }
        }
        lblMilesError.Text = "No Error";
    }
    catch (FormatException fEx)
    {
        lblMilesError.Text = fEx.Message;
    }
}

My Defined class of MilesCal

 class MilesCal
    {
        public int MilesRepay(int a)
        {
            int x;
            return x = (a*5)/100;
        }
        public int MilesRepay(int a, int b)
        {
            int y;
            return y = (a*5)/100 + (b*2)/100;
        }
    }

This code is suppose to display in a label the cost a driver gets back from their driving at 5p for the first 200 miles then 2p after that. I have got the code working but then discovered that it has to be done using Method overflow. at the minute am getting an error Error 1 Cannot convert method group ‘ToString’ to non-delegate type ‘string’. Did you intend to invoke the method? at

lblMilesShow.Text = carry.ToString;

Added the ().

Now the catch seems to be trippping, can i ask you guys again to work this out because its probably a simple fix again?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:24:06+00:00Added an answer on May 28, 2026 at 2:24 am

    Try to add brackets

    lblMilesShow.Text = carry.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code example: private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { if(some condition) { comboBox.Text =
private void button5_Click(object sender, EventArgs e) { if (domainUpDown2.Text == Battlefield: Bad Company 2)
private void dateTimePicker1_ValueChanged(object sender, Series myseries, int multiplier, EventArgs e) { if (datelimitsset ==
private void button1_Click(object sender, EventArgs e) { string name; name = textBox5.Text; SqlConnection con10
private void btnBrowserGo_Click(object sender, EventArgs e) { browser.Navigate(txtBrowserURL.Text); } The code above directs the
private void btnStart_Click(object sender, EventArgs e) { Random random = new Random(); int randomNumber
private void btnGo_Click(object sender, EventArgs e) { Array IDlist = txtUserID.Text.Split(new char[] { });
private void button2_Click(object sender, EventArgs e) { int i = 5; MessageBox.Show(i); } Fails..
private void delete_Click(object sender, EventArgs e) { convertedText.Text = ; } private void copy_Click(object
private void button1_Click(object sender, EventArgs e) { int[] ml = new int[10] ( 1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.