Posts

How to Set Multiple Startup Projects in Visual Studio.

To set multiple startup projects In the Solution Explorer , select the solution. Right-click the node to get the context menu. Select Properties . The Solution Property Pages dialog box opens. Expand the Common Properties node, and click Startup Project . Click Multiple Startup Projects and set the appropriatet actions.

NuGet - Check Combo Box

Step 1:  Get the NuGet package https://www.nuget.org/packages/Common.CheckComboBox/ Step 2: Add the CheckComboBox Control in the toolbar. Click here Step 3: Drag the "CheckedComboBox" control from the toolbar to the form to the position where it should be placed   Step 4: Add items to the CheckedComboBox control by        for (int i = 0; i < 10; i++)             {                 checkedComboBox1.Items.Add(i);             }

How to get the list of properties of a class?

public List<string> GetPropertiesNameFromClass(object pObject) { List<string> propertyList = new List<string>(); if (pObject != null) { foreach (var prop in pObject.GetType().GetProperties()) { propertyList.Add(prop.Name); } } return propertyList; } public static Dictionary<string, object> GetPropertDictionaryFromClass(object pObject) { if (pObject == null) return new Dictionary<string, object>(); Type t = pObject.GetType(); PropertyInfo[] props = t.GetProperties(); Dictionary<string, object> dict = new Dictionary<string, object>(); foreach (PropertyInfo prp in props) { object value = prp.GetValue(pObject, new object[] { }); dict.Add(prp.Name, value); } return dic

Convert byte array to Image and Image to byte array

Convert Image to byte[] array: public byte [] imageToByteArray(System.Drawing.Image imageIn) { MemoryStream ms = new MemoryStream(); imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif); return ms.ToArray(); } Convert byte[] array to Image : public Image byteArrayToImage( byte [] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; }

BreakPoints Are Not Working in Visual Studio

Solution Right-click on your project. Select [Properties]. Select the [Build] tab. Ensure [Define DEBUG constant] and [Define TRACE constant] are checked. Click the [Advanced] button at the bottom of the Build tabpage. Ensure that [Debug Info:] is set to [full]. Click [OK] and rebuild the project. Solution   Disable the "Just My Code" option in the Debug/General settings.

Gesture Recognizers with Xamarin.Forms

Why gestures ?   Some controls does not have support click event. In order to achieve add the below code this will enabling click event in the controls.. Gestures are mainly of 3 types Tap Gesture Recognizer Pinch Gesture Recognizer Pan Gesture Recognizer 1) Tap Gesture Recognizer var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += tapGestureRecognizer_Tapped; Controler_Name.GestureRecognizers.Add(tapGestureRecognizer); void tapGestureRecognizer_Tapped(object sender, EventArgs e) { ........//Code here } 2) Pinch Gesture Recognizer var pinchGestureRecognizer = new PinchGestureRecognizer(); pinchGestureRecognizer.PinchUpdated += pinchGestureRecognizer_PinchUpdated; Controler_Name.GestureRecognizers.Add(pinchGestureRecognizer); void pinchGestureRecognizer_PinchUpdated(object sender, PinchGestureUpdatedEventArgs e) { ........//Code here } 3) Pan Gesture Recognizer var panG

List all tables to be truncate

--Get the list of all the tables to be truncated   DECLARE @TablesToBeTruncated AS TABLE   (Id INT IDENTITY(1,1),TableObjectId INT , TableName SYSNAME,      SchemaId INT ) INSERT INTO @TablesToBeTruncated   SELECT ST.object_id,ST. name ,ST.schema_id   FROM sys.Tables ST   WHERE ST.type = 'U' AND ST. NAME NOT LIKE '#%'   AND ST. name <> 'sysdiagrams'   --AND ST.NAME NOT IN ('') -- Specify here the comma separated table names for which truncation is not required   --AND ST.NAME IN ('') -- Specify here the comma separated table names which needs to be truncated     --Generate the foreignkeys drop and create back script DECLARE @CreateScript AS NVARCHAR( MAX ), @DropScript AS NVARCHAR( MAX ) SELECT      ------------DROP SCRIPT--------------------      @DropScript = ISNULL (@DropScript, '' ) + 'ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(Tlist.SchemaId)) + '.'       + QUOT