Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>if i don't misunderstand you want to set the datagridview's combobox column's datasource..You can set by this : </p> <pre><code>/// if you use OfType Method then you will get advantage of to use as normal control /// means this method will give you advantage of can use all method and properties /// of the control which you want to implement in DataGridView /// Controls.OfType method will check all the columns and get an array with /// what you give as search criteria..here, the criteria is ComboboxColumn.. /// depends of your need you can give comboboxcell also.. /// Element at method selects the zero based index in array which filtered by criteria /// if you use only one of the given type then you can use .First() instead of .ElementAt() yourDataGridViewName.Controls.OfType&lt;DataGridViewComboBoxColumn&gt;() .ElementAt(indexNoOfTheDGVComboBox).DataSource = YourDataRetrievingMethod; //i.e. ds.Tables[indexNoOfTheTable].Columns[IndexOfTheColumn] /// and you can set DisplayMember and ValueMember as the same way.. /// i give combocell and combocolumn together to show the syntax. yourDataGridViewName.Controls.OfType&lt;DataGridViewComboBoxCell&gt;() .ElementAt(0).DisplayMember = "YourDisplay"; yourDataGridViewName.Controls.OfType&lt;DataGridViewComboBoxCell&gt;() .ElementAt(0).ValueMember = "YourValue"; </code></pre> <p>About the second Question.. if you ask me then i prefer : To control "accidentally savings" put a buttonCell at the end of the row..when user change something on row should click the save button..And then in your button click method you can save changes as normal insert or update method..</p> <p>just 2 differences there..</p> <p>1-) you need to use <code>Cell_Click</code> Event and to be sure that is button check with <code>OfType()</code> method instead of normal <code>Button _Click</code> event</p> <p>2-) Depends to project needs, you will need to get DataGridView's <code>RowIndex</code> and / or <code>Cell Address()</code> before to get and pass values to the SQLQuery</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload