How can I call this function?

  • Thread starter Thread starter trint
  • Start date Start date
T

trint

static void PrinterStatus(string[] args)
(
....code
}

I tried this:

PrinterStatus();
and get this error:
No overload for method 'PrinterStatus' takes '0' arguments
thanks,
Trint
 
trint said:
static void PrinterStatus(string[] args)
(
...code
}

I tried this:

PrinterStatus();
and get this error:
No overload for method 'PrinterStatus' takes '0' arguments
thanks,
Trint

try this:

string[] args = new string[];
PrinterStatus(args);
 
Compile error is "must have array initializer for this:
string[] args = new string[];
Thanks,
Trint
 
hmmmm

PrinterStatus(new string[] {""});

?

or
string[] arr = new string[] {"myFirstArgument", "mySecondArgument"};
PrinterStatus(arr);

or

string[] arr = new string[2];
arr[0]="first";
arr[1]="second";
PrinterStatus(arr);

HTH,
F.O.R.
 
trint said:
Compile error is "must have array initializer for this:
string[] args = new string[];
Thanks,
Trint

What kind of arguments your function expects? if you don't know, then just
have to initialize it empty:

PrinterStatus(new string[] {""});

But your PrintStatus func has 2 be static, or U get object reference
exception.
 
Hi,

You have to pass an array of string , you have to find what the method does
with it.

you could try :

PrinterStatus( null);

or

PrinterStatus( new string[] {""} );

but if you don;t know what to pass the method would not work as expected.


cheers,
 
Sorry, still don't have this working properly:

public class Form1 : System.Windows.Forms.Form
{

if (printer["WorkOffline"].ToString().ToLower().Equals("true"))
{

listBox1.Items.Add(stRing);
// printer is offline by user
// Console.WriteLine("Your Plug-N-Play printer is not connected.");
}

public void AddComboBoxItem ( object item )
{
comboBox1.Items.Add ( item );
}

}


Net programmer
(e-mail address removed)
 
Hi,

As I told you before, you need to know what the string[] parameter means

cheers,
 
Back
Top