private void button1_Click(object sender, EventArgs e) { String CountrySelect = Country.SelectedValue.ToString(); SQLProcess defaults = new SQLProcess(); DataSet info = defaults.DefaultCountryConfig(CountrySelect); dataGridView1.AutoGenerateColumns = false; dataGridView1.RowHeadersVisible = false; SetupColumns(info); dataGridView1.DataSource = info.Tables["Country"]; Country.Enabled = false; button1.Enabled = false; } private void SetupColumns(DataSet info) { //Setup variables for gridview //Setup DataGridViewTextBoxColumn FName = new DataGridViewTextBoxColumn(); FName.DataPropertyName = "FName"; FName.HeaderText = "Field Name"; FName.ValueType = typeof(String); FName.Frozen = true; dataGridView1.Columns.Add(FName); SQLProcess Fieldtype = new SQLProcess(); DataSet DTypes = Fieldtype.FieldTypes(); DataGridViewComboBoxColumn FType = new DataGridViewComboBoxColumn(); FType.DataPropertyName = "Ftype"; FType.HeaderText = "Field Type"; FType.DataSource = DTypes.Tables["FieldTypes"]; FType.DisplayMember = "FieldType"; FType.ValueMember = "FieldTypeValue"; FType.Frozen = true; FType.Width = 100; dataGridView1.Columns.Add(FType); DataGridViewTextBoxColumn Position = new DataGridViewTextBoxColumn(); Position.DataPropertyName = "FPosition"; Position.HeaderText = "Position"; Position.ValueType = typeof(Int32); Position.Frozen = true; dataGridView1.Columns.Add(Position); DataGridViewCheckBoxColumn Requierd = new DataGridViewCheckBoxColumn(); Requierd.HeaderText = "Requierd"; Requierd.Frozen = true; Requierd.Width = 50; dataGridView1.Columns.Add(Requierd); DataGridViewCheckBoxColumn Option = new DataGridViewCheckBoxColumn(); Option.HeaderText = "Option"; Option.DataPropertyName = "Foption"; Option.ValueType = typeof(String); Option.Frozen = true; Requierd.Width = 30; dataGridView1.Columns.Add(Option); }
if(dataGridView1.CurrentRow.Cells["the name of the column you wish to check its value"].Value=="whatever the value to check") { dataGridView1.currentRow.ReadOnly=true; }
dataGridView1["(your desired column)", dataGridView1.CurrentRow.Index].ReadOnly = dataGridView1["(the column to take the check value)", dataGridView1.CurrentRow.Index].Value;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)