My MainForm opens up the AddTicketForm, to create and add an entry, prior to the closing of the AddTicketForm, it is supposed to call the function on the MainForm that will refresh the DataGrid, so that it will show the newly added entry... But for some reason it will not allow me on the AddTicketForm to create an object reference of the MainForm so that I may call the function... I keep getting the error "No overload for method 'MainForm' takes '0' arguments"... Here's my code...
namespace MPCS
{
public partial class MainForm : Form
{
public void loadTicketsDataGrid(int CID)
{
ticketsDataGridView.DataSource = TicketsQueries.GetTicketsByCustomerID(CID);
ticketsDataGridView.Columns[0].Name = "TicketID";
ticketsDataGridView.Columns[0].DataPropertyName = "TicketID";
ticketsDataGridView.Columns[0].Width = 5;
ticketsDataGridView.Columns[0].HeaderText = "";
ticketsDataGridView.Columns[0].Visible = false;
etc. etc. etc.
}
private void addTicketToolStripMenuItem_Click(object sender, EventArgs e)
{
AddTicketForm AddTicketForm = new AddTicketForm(this);
AddTicketForm.ShowDialog();
}
}
}
namespace MPCS
{
public partial class AddTicketForm : Form
{
private int CID = 0;
public AddTicketForm(MainForm Form1)
{
InitializeComponent();
CID = Form1.CID;
}
private void newTicketButton_Click(object sender, EventArgs e)
{
code code code
if (errorTracker == 0)
{
decimal ticketProfit = (ticketTotal * TherapistPercentage) / 100;
TicketsQueries.InsertTicket(ticketDateTimePicker.Value, ticketDescriptionTextBox.Text, TID, CID, billedTime, billedRate, ticketTotal, ticketPaidComboBox.Text, ticketProfit);
MainForm mForm = new MainForm();
mForm.loadTicketsDataGrid(CID);
this.Close();
}
}
}
}
The error is on "MainForm mForm = new MainForm();"

New Topic/Question
Reply


MultiQuote









|