public static void fillCheckList(string ListType,int RecordNum,CheckBox chkRequired,TextBox txtComplete,TextBox txtMemo)
{
string sql_Check = String.Format(@"SELECT l.Required,l.Completed,l.ISP,l.Memo_Notes,
t.List_Desc
FROM List_Data l, List_Type t
WHERE l.List_ID = t.List_ID
AND l.Record_Num = {0}
AND t.List_Desc = '{1}'", RecordNum,ListType);
ListData LIST = new ListData();
SqlConnection sqlConn = null;
SqlCommand cmd_Check;
SqlDataReader dr_Check;
try
{
sqlConn = new SqlConnection(databaseConnectionString);
sqlConn.Open();
cmd_Check = new SqlCommand(sql_Check, sqlConn);
dr_Check = cmd_Check.ExecuteReader();
while (dr_Check.Read())
{
LIST = new ListData(Convert.ToBoolean(dr_Check["Required"]), dr_Check["Completed"].IsNull() ? (DateTime?)null : Convert.ToDateTime(dr_Check["Completed"]), dr_Check["Memo_Notes"].ToString());
}
chkRequired.Checked = LIST.REQUIRED;
txtComplete.Text = LIST.COMPLETED.HasValue ? LIST.COMPLETED.Value.ToShortDateString() : "";
txtMemo.Text = LIST.MEMO_NOTES;
}
catch (Exception e)
{
MessageBox.Show("Error found in fillCheckList..." + Environment.NewLine + e.ToString());
}
finally
{
if (sqlConn != null)
{
sqlConn.Close();
}
}
}
As you can see, i take in an integer variable for the project id, a string variable for list type, and 2 text box type. i am thus using this method to accept 4 arguments.. what i want to do is that i also want it to accept 5 arguments . that is.. include one more text box.. so that it either takes 4 arguments or 5 arguments accordingly/ how do i do that in the same method.