C# Snippets


Question_RowDelete

public static bool Question_RowDelete(System.Int32 iDefaultButton = 1, bool bFlagError = false)
{
bool breturn;
System.Windows.Forms.DialogResult objreturn;
System.Windows.Forms.MessageBoxDefaultButton objdefaultbutton;

switch (iDefaultButton)
{
case 1:
{
objdefaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button1;
break;
}

case 2:
{
objdefaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button2;
break;
}
}

objreturn = System.Windows.Forms.MessageBox.Show("Are you sure you want to delete this row ?", gobjSolution.SolutionFormTitle, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, objdefaultbutton);

if (objreturn == System.Windows.Forms.DialogResult.Yes)
breturn = true;
if (objreturn == System.Windows.Forms.DialogResult.No)
breturn = false;

// sets the flag to an error
clsError.ErrorFlagChange(bFlagError);

return breturn;
}
Public Shared Function Question_RowDelete(Optional ByVal iDefaultButton As System.Int32 = 1,
Optional ByVal bFlagError As Boolean = False) _
As Boolean
Dim breturn As Boolean
Dim objreturn As System.Windows.Forms.DialogResult
Dim objdefaultbutton As System.Windows.Forms.MessageBoxDefaultButton

Select Case iDefaultButton
Case 1 : objdefaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button1
Case 2 : objdefaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button2
End Select

objreturn = System.Windows.Forms.MessageBox.Show(
"Are you sure you want to delete this row ?",
gobjSolution.SolutionFormTitle,
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question,
objdefaultbutton)

If objreturn = System.Windows.Forms.DialogResult.Yes Then breturn = True
If objreturn = System.Windows.Forms.DialogResult.No Then breturn = False

'sets the flag to an error
clsError.ErrorFlagChange(bFlagError)

Return breturn
End Function

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top