Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

c# winform set focus to the current row datagridview combobox

$
0
0

I have I am trying to place a edit on a datagridview row. If a user tries to update any field on the current row on the DVG but has not selected a optioninthe combobox. I want to display a message and put the cursor on the combo box field on that row. I have searched fora awhile thismorning but have yet to find a way.

            var selectedValue = dgvShift_Printers.CurrentRow.Cells["dgvCbPrinter"].Value;
            if ( selectedValue == DBNull.Value || string.IsNullOrEmpty((string)selectedValue) )
            {
                MessageBox.Show("You must select a printer before continuing! ");
                shift_LogBindingSource.CancelEdit();
                // Set focus to the combobox
                return;
            }


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>