Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Return type error

Return type error

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mprice214
    wrote on last edited by
    #1

    Hi all, I have a button click event that is used to write a double used for offsetting another number in a form (ultimately to zero a display). Still struggling as a new user and having problem with an error: 'double WindowsApplication14.frmMain.btnZero_Click(object, System.EventArgs)' has the wrong return type Here is the function:

    private double btnZero_Click(object sender, EventArgs e)
    {
    dblOffset = dblReceive * -1;
    return dblOffset;
    }

    Can anyone let me know what I'm doing wrong here? Thanks. :zzz:

    A 1 Reply Last reply
    0
    • M mprice214

      Hi all, I have a button click event that is used to write a double used for offsetting another number in a form (ultimately to zero a display). Still struggling as a new user and having problem with an error: 'double WindowsApplication14.frmMain.btnZero_Click(object, System.EventArgs)' has the wrong return type Here is the function:

      private double btnZero_Click(object sender, EventArgs e)
      {
      dblOffset = dblReceive * -1;
      return dblOffset;
      }

      Can anyone let me know what I'm doing wrong here? Thanks. :zzz:

      A Offline
      A Offline
      ali_reza_zareian
      wrote on last edited by
      #2

      you cant use return type for click event. you should use void for click event. the signature of method that you can use for click event is: void methodname(object,EventArgs)

      M 1 Reply Last reply
      0
      • A ali_reza_zareian

        you cant use return type for click event. you should use void for click event. the signature of method that you can use for click event is: void methodname(object,EventArgs)

        M Offline
        M Offline
        mprice214
        wrote on last edited by
        #3

        Do you have any suggestion for how I would get around this? Need to look at the current value of a double and then null it by clicking a button labeled "Zero". That is why dblOffset is equal to dblReceive * -1. I want to add dblOffset at that moment to dblReceive, which would then set dblReceive to zero. Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups