Hello:
I am a bit new to c#, have been using VB for years.
I have setup a database using the ADO.NET Entity Data Model, and am trying to now filter some of this on a form, after of course reading all kinds of articles. It seems to be working, but I would like to first..
Display the record based on a value in a textbox field (I will convert this to combobox later).
Display a sub form with a datagridview based on the same information.
Right now, I am erroring here in the loadJobs sub
Full code below:
Thanks for any info you can provide!
I am a bit new to c#, have been using VB for years.
I have setup a database using the ADO.NET Entity Data Model, and am trying to now filter some of this on a form, after of course reading all kinds of articles. It seems to be working, but I would like to first..
Display the record based on a value in a textbox field (I will convert this to combobox later).
Display a sub form with a datagridview based on the same information.
Right now, I am erroring here in the loadJobs sub
C#:
txtCustomer.Text = getrecord.Customer;
Full code below:
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ResourcePlanningC
{
public partial class frmProduction : Form
{
static bool bInstForm = false;
public frmProduction()
{
InitializeComponent();
loadJobs();
loadJobDetails();
}
private void loadJobs()
{
// using (var db = new ResourcePlanningEntities())
{
string pn = txtProjectNumber.Text;
ResourcePlanningEntities db = new ResourcePlanningEntities();
var getrecord = db.Jobs.Where(a => a.ProjectNumber == pn);
txtCustomer.Text = getrecord.Customer;
}
}
private void loadJobDetails()
{
using (var db = new ResourcePlanningEntities())
{
dgvJobDetail.DataSource = db.JobDetails.ToList();
}
}
private void frmProduction_Load(object sender, EventArgs e)
{
if (!bInstForm)
bInstForm = true;
else
this.Dispose();
}
private void frmProduction_FormClosing(object sender, FormClosingEventArgs e)
{
if (bInstForm)
bInstForm = false;
}
}
}
Thanks for any info you can provide!