Not sure where I went wrong here.
I have a class called EMails and routine called EmailEvent, which is called from another page. Here is the method declaration:
public void EmailEvent(
string evtDate,
string evtName,
string evtContact,
string evtBody,
string lnkMinutes,
string lnkTReports,
String[] textTo)
As you'll see, I'm passing in an array. On the page calling the routine I have this code:
ArrayList mailIDs = new ArrayList();
switch (ddlSelection.SelectedValue.ToString())
{
case "One":
mailIDs.Add(ddlallMembers.SelectedValue.ToString());
break;
case "Members":
mailIDs.Add(ddlSelection.SelectedValue.ToString());
break;
case "Prospects":
mailIDs.Add(ddlSelection.SelectedValue.ToString());
break;
case "All":
mailIDs.Add(ddlSelection.SelectedValue.ToString());
break;
case "List":
for (int mems = 0; mems < lbChosen.Items.Count; mems++)
{
mailIDs.Add(lbChosen.Items[mems].Value);
}
break;
default:
Response.Write("<script>alert('Invalid Selection. Try again.')</script>");
break;
}
String[] myArr = (String[]) mailIDs.ToArray( typeof( string ) );
Emails.EmailEvent(
tbEventDt.Text,
tbEvent.Text,
tbContact.Text,
tbEventText.Text,
hlMinutes.Target.ToString(),
hlTReport.Target.ToString(),
myArr);
So I'm passing all my params, seems to be correct, but the last line is marked as error as follows:
Error 5 An object reference is required for the non-static field, method, or property 'Emails.EmailEvent(string, string, string, string, string, string, string[])'
I've tried many variations of params (pass JUST the array, pass everything EXCEPT the array with appropriate changes to the procedure). Always the same error.
So what'd I do wrong? This is the first time I've ever tried to pass an array (could be 1 value, could be a dozen).