Hi all,
I'm trying to implement a Windows Form with the following features:
DatagridView that has Product Category information.
The grid columns are:
Category Name, Tax Class Name, Category Type
I've attached a screenshot of my form.
http://a.imagehost.org/0765/frmCategory.jpg I'm using LINQ to SQL. And I have my DBML file defined like this:
Tax
TaxID
TaxName
TaxValue
Category
CategoryID
CategoryName
CategoryType
TaxID
On DBML I have the correct relationship on it. (see the attachement)
http://a.imagehost.org/0515/DBML.jpg
This is my FormLoad
private void frmCategory_Load(object sender, EventArgs e)
{
var category = from c in myDataContext.Categories
join t in myDataContext.Taxes on c.TaxID equals t.TaxID
select new { c.CategoryID, c.CategoryName, c.CategoryType, t.TaxName };
var Tax = from t in myDataContext.Taxes
select t;
cmbTaxType.DataSource = Tax;
cmbTaxType.DisplayMember = "TaxName";
cmbTaxType.ValueMember = "TaxID";
bs = new BindingSource(category, null);
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = bs;
txtName.DataBindings.Add("Text", bs, "CategoryName");
cmbTaxType.DataBindings.Add("DisplayMember", bs, "Taxes.TaxName");
cmbTaxType.DataBindings.Add("ValueMember", bs, "Taxes.TaxID");
}
My questions:
a) I want to bind the datagrid with the textbox, combobox and radbutton
b) I'm able to bind with textbox and combobox but did not get success on radbutton
c) On my cmdNew_Click button I have a bs.AddNew(). When I try to do it, I receive a error message saying that I'm not able to addnew items on readonly object or size limited.
I'm totally new using LINQ and bindings, so any help here are truly welcome.
Thanks in advance,
Fernando Possebon