-
May 1st, 2011, 01:58 PM
#1
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?
-
May 2nd, 2011, 08:40 AM
#2
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();
}
-
May 3rd, 2011, 01:07 AM
#3
Re: no overload for method 'GenerateNumberOfPolicies' takes '0' arguments
Originally Posted by MrJokster
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.
-
May 3rd, 2011, 01:08 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|