/// <summary> /// Checks if the textbox value is an integer. /// </summary> /// <returns>Returns true if is an integer, false otherwise.</returns> bool pasteTxtCheckForInt(TextBoxPaste txt) { int readed; if (int.TryParse(txt.GetPastedText(), out readed)) { txt.Text = readed.ToString(); return(true); } return(false); }
private void pasteCalLoc(object sender, EventArgs e) { TextBoxPaste txt = (TextBoxPaste)sender; if (pasteTxtCheckForInt(txt)) { return; } if (pasteToXY(txtInCalLocX, txtInCalLocY, txt.GetPastedText())) { btnCalibrate.Focus(); } }
private void pasteDstLoc(object sender, EventArgs e) { TextBoxPaste txt = (TextBoxPaste)sender; if (pasteTxtCheckForInt(txt)) { return; } if (pasteToXY(txtInDstX, txtInDstY, txt.GetPastedText())) { // If the paste was successful, perform the calculation. btnCalculate.Focus(); btnCalculate.PerformClick(); } }