CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    4

    no overload for method 'GenerateNumberOfPolicies' takes '0' arguments

    All I'm trying to do is get a data generator to put a random number into a box. This is the code for this part of the generator:

    /// <summary>
    /// Generates the next number of policies a person has.
    /// </summary>
    /// <param name="Max">The maximum number of policies allowed.</param>
    /// <returns>A number of policies as an integer.</returns>
    public Int32 GenerateNumberOfPolicies(int Max)
    {
    return _RandomNumberGenerator.Next(0, Max);

    My professor wrote that code and told the class to use it.
    This is what I've wrote:

    private void TestButton_Click(object sender, EventArgs e)
    {
    FirstNameTextBox.Text = m_idgTestData.GenerateFirstName();
    LastNameTextBox.Text = m_idgTestData.GenerateLastName();
    CustIDTextBox.Text = m_idgTestData.GenerateRandomID();
    NumPolicyTextBox.Text = m_idgTestData.GenerateNumberOfPolicies();
    }

    I had no issues generating random data for the first 3 text boxes but now I'm getting an error for code that I didn't write and haven't been taught yet.
    What's the issue here?

  2. #2
    Join Date
    Dec 2008
    Posts
    144

    Re: no overload for method 'GenerateNumberOfPolicies' takes '0' arguments

    First of all thanks for telling us this is a homework assignment- we'll point you in the right direction but you'll have to figure it out yourself.

    Second, please use code tags when posting code in the future- makes it easier for us to read.

    This is a very simple problem and the answer is staring you in the face. Take a good look at the declaration line of the GenerateNumberOfPolicies method- the answer is very plain. While you're looking, think about what an argument is.

    Post back if you have problems figuring this out.
    Code:
    if (Issue.Resolved)
    {
         ThreadTools.Click();
         MarkThreadResolved();
    }

  3. #3
    Join Date
    May 2011
    Posts
    5

    Re: no overload for method 'GenerateNumberOfPolicies' takes '0' arguments

    Quote Originally Posted by MrJokster View Post
    All I'm trying to do is get a data generator to put a random number into a box. This is the code for this part of the generator:

    /// <summary>
    /// Generates the next number of policies a person has.
    /// </summary>
    /// <param name="Max">The maximum number of policies allowed.</param>
    /// <returns>A number of policies as an integer.</returns>
    public Int32 GenerateNumberOfPolicies(int Max)
    {
    return _RandomNumberGenerator.Next(0, Max);

    My professor wrote that code and told the class to use it.
    This is what I've wrote:

    private void TestButton_Click(object sender, EventArgs e)
    {
    FirstNameTextBox.Text = m_idgTestData.GenerateFirstName();
    LastNameTextBox.Text = m_idgTestData.GenerateLastName();
    CustIDTextBox.Text = m_idgTestData.GenerateRandomID();
    NumPolicyTextBox.Text = m_idgTestData.GenerateNumberOfPolicies();
    }

    I had no issues generating random data for the first 3 text boxes but now I'm getting an error for code that I didn't write and haven't been taught yet.
    What's the issue here?
    First you want to call the GenerateNumberOfPolicies method sending parameter as int type.

  4. #4
    Join Date
    May 2011
    Posts
    5

    Re: no overload for method 'GenerateNumberOfPolicies' takes '0' arguments

    First you want to call the GenerateNumberOfPolicies method sending parameter as int type.if you want to call the methos tou want to create a instance of object .without object means you want to use static.

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