Now it's working I was giving the class name and form name as same name.
PurchaseInvoice purchaseInvoice = new PurchaseInvoice();
if (e.RowIndex >= 0)
{
DataGridViewRow row = ddlgrdParty.Rows[e.RowIndex];
purchaseInvoice.txtPartyname.Text = row.Cells[0].Value.ToString();
purchaseInvoice.txtMobile.Text = row.Cells[1].Value.ToString();
}