I am getting an error of
Error CS7036 There is no argument given that corresponds to the required formal parameter 'b2' of 'Form1.checkInfo(PointF, PointF, PointF, PointF, ref PointF)' WindowsFormsApplication1
b2
private void button1_Click(object sender, EventArgs e)
{
Point[] points = new Point[] { new Point { X = -100, Y = 0 }, new Point { X = 0, Y = 0 } };
PointF returnedPoint = new PointF();
for (int i = 0; i < points.Count(); i++)
{
float X1value = points[i].X;
float X2value = points[i-1].X;
float Y1value = points[i].Y;
float Y2value = points[i-1].Y;
checkInfo(new PointF(X1value, Y1value), new PointF(X2value, Y2value), ref returnedPoint);
}
}
bool checkInfo(PointF a1, PointF a2, PointF b1, PointF b2, ref PointF returnedPoint)
{
//Do stuff here
}
Error CS7036 There is no argument given that corresponds to the required formal parameter 'b2' of 'Form1.checkInfo(PointF, PointF, PointF, PointF, ref PointF)' WindowsFormsApplication1
Your method checkInfo(PointF a1, PointF a2, PointF b1, PointF b2, ref PointF returnedPoint)
takes 5 parameters, but you call it checkInfo(new PointF(X1value, Y1value), new PointF(X2value, Y2value), ref returnedPoint)
with only 3 parameters. The error message complains about missing parameters.
Please see my comments below:
private void button1_Click(object sender, EventArgs e)
{
Point[] points = new Point[] { new Point { X = -100, Y = 0 }, new Point { X = 0, Y = 0 } };
PointF returnedPoint = new PointF();
for (int i = 0; i < points.Count(); i++)
{
float X1value = points[i].X;
float X2value = points[i-1].X;
float Y1value = points[i].Y;
float Y2value = points[i-1].Y;
// Error located here: Only 3 parameters passed - You need to pass 2 more instances of 'PointF'
checkInfo(new PointF(X1value, Y1value), new PointF(X2value, Y2value), ref returnedPoint);
}
}
// Takes 5 parameters
bool checkInfo(PointF a1, PointF a2, PointF b1, PointF b2, ref PointF returnedPoint)
{
//Do stuff here
}