Tag Archives: C#

C# keystroke to reformat code, align code, beautify code, update code layout, standardize code

C# keystroke to reformat code, aka. align code, beautify code, update code layout, standardize code. Standard keys: Ctrl-E, D : format entire document. Ctrl-E, F: format current selection. Code Formatting The C# code editor automatically formats code when you press … Continue reading

Posted in Parenting | Tagged , | Leave a comment

Open a file using the system-defined application

  // Open the Excel spreadsheet. Common Reasons and Solutions of Male Erectile Dysfunction problem.Sildenafil citrate works over an inhibiting enzyme which lies in the male penis and it viagra lowest prices restricts the hardening and erection of the penis. … Continue reading

Posted in Parenting | Tagged , | Leave a comment

ExcelInterop.cs

  using System; using System.Collections.Generic; using System.Linq; using System.Text; using Excel = Microsoft.Office.Interop.Excel; using System.Reflection;    //Missing.Value using System.Windows.Forms; //Messagebox   namespace MesUtilities {     class ExcelInterop     {           #region member fields           Excel.Application objApp;         Excel._Workbook objBook; … Continue reading

Posted in Parenting | Tagged , | Leave a comment

Excel Interop: Query into DataGridView, Save to spreadsheet, Open via Excel.

This requires ExcelInterop.cs           private void btnListAllUsers_Click(object sender, EventArgs e)         {             SaveListOfAllUsers();         }           private void SaveListOfAllUsers()         {             DataTable dtUserList = new DataTable();             // use an invisible DataGridView on the UI form. … Continue reading

Posted in Parenting | Tagged , | Leave a comment

Handle key events at windows form level in C#

1. In the form constructor: this.KeyPreview = true; //Enable form-level keyboard event handling. 2. Populate the form’s KeyDown event handler. This event occurs before KeyPress, TextChanged, and KeyUp. private void frmSimpleValidator_KeyDown(object sender, KeyEventArgs e) {     ValidateFormKeydown(this, e); } 3. … Continue reading

Posted in Parenting | Tagged , | Leave a comment

C# Convert string to GUID / SqlDbType.UniqueIdentifier

SqlConnection sConnection = new SqlConnection(sMesConnectionString); string sql = “INSERT INTO ACA_KC_Atps ” + “( KC_Product_ID, Atp_Version_Name, Creation_Date) ” + “VALUES ” + “(@KC_Product_ID, @Atp_Version_Name,@Creation_Date) “; SqlCommand sCommand = new SqlCommand(sql, sConnection); sCommand.Parameters.Add(“@KC_Product_ID”, SqlDbType.UniqueIdentifier).Value = new Guid(KC_Product_ID); Availability of the medicine … Continue reading

Posted in Parenting | Tagged , | Leave a comment

Quick Tip: Extract data from XML fragment

/// /// Using the user previously validated via VerifyCredentials(), /// determine whether the user is in group Administrator level 1″. /// Users can be in only one group; no looping is necessary. /// /// public bool IsUserMesAdminLevelOne() { bool result … Continue reading

Posted in Parenting | Tagged | Leave a comment