0

hi there,

i have a combo box cell in the datagrid view and to it the data is loded from the database.
w@ i want is when i select a value from the combo box cell the other cells should be filled with the data relating to the value selected.
thankxxxx

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by judithSampathwa
0

for that u have to write query in to the selectedindexchange event of that datgrideviews combo box and for further assist please display your code

0

for that u have to write query in to the selectedindexchange event of that datgrideviews combo box and for further assist please display your code

hey there is no selectedindexchange in the datagrid view. i want to put the below code to the datagridview cells when the first cell value is selected,
how can i do this

if (dgvSubContractor.CurrentCell == null)
                return;

            if ((dgvSubContractor.CurrentCell.Value != null))
            {
                dgvSubContractor.CommitEdit(DataGridViewDataErrorContexts.Commit);
                if (dgvSubContractor.CurrentCell.ColumnIndex == 0)
                {
                    int r = dgvSubContractor.CurrentCell.RowIndex;

                    int l = pp.DisplaySubContractName().Length;
                    String name = dgvSubContractor.Rows[r].Cells[0].Value.ToString();
                    String[] SubNames = new String[l];

                    SubNames = pp.getSubContractorDetails(name);

                    dgvSubContractor.Rows[r].Cells[1].Value = SubNames[0].ToString();
                    dgvSubContractor.Rows[r].Cells[2].Value = SubNames[1].ToString();
                    dgvSubContractor.Rows[r].Cells[3].Value = SubNames[2].ToString();
                    dgvSubContractor.Rows[r].Cells[4].Value = SubNames[3].ToString();
                }
            }

thankxxxxx

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.