Category "c++sharp"

Date Diff By Ignoring Leap Days

Please share some logic to find date difference between two dates which would ignore leap days, c# Subtract method includes the leap days. E.g. for startDat= 26

Insert radio button selected value into database

I am building a C# Windows application with 2 radio buttons for gender. I'm using a simple insert query to insert data in the database. Can anyone help me wit

'Forms' does not exist in the namespace system.windows

I have just started working on c#, and was fiddling with some code sample that I got from some forum. This code is using a namespace using system.windows.forms

Custom ContextMenu Command in Datagrid's Textbox from ViewModel

I have a UserControl which includes Datagrid. Inside Datagrid I've set EditingElementStyle with Textboxes that have ContextMenu for Copy/Paste commands. I need

Fastest way to search Nested List<> in C#

I have a List<> which contains another List<> I need to find if a given value is present in any of the items in the innermost list. If match found,

SendGrid Dynamic Email Template won't pass data from .NET

I'm trying to use SendGrid's API to send Data to a Dynamic Template, and send that email to a customer. However, the email sends, but the data is never passed.

how to find out textbox value is greater than datagridview cell value in c#

i have a numeric value in textbox which is retrieve from sql database, meanwhile i have unbound GridView with some rows. now i want to compare the textbox v

Where should I put this object property/attribute

I am creating a testing program. The three main objects I have right now are Tests, Questions, and Answers. I have three tables in the database, tests, question

How to resize multidimensional (2D) array in C#?

I tried the following but it just returns a screwed up array. T[,] ResizeArray<T>(T[,] original, int rows, int cols) { var newArray = new

Export to Excel for telerik radgrid

I want to export current date along with radgrid data to the excel sheet. How can I do this? For exporting radgrid I am using following code: public void Expo

Check if a record exists in the database

I am using these lines of code to check if the record exists or not. SqlCommand check_User_Name = new SqlCommand("SELECT * FROM Table WHERE ([user] = '" + txtBo

AutoMapper convert from multiple sources

Let's say I have two model classes: public class People { public string FirstName {get;set;} public string LastName {get;set;} } Also have a class Phone:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Facebook; using Newtonsoft.Json; namespace facebook { class Pro

C# Moq: How to I create a create a Mock that returns the input with a field adjusted

I am trying to mock a sub-process for my tests. I know I can return the input to the function I am mocking as such: Mock<MockedObject> mock = new Mock<

Monitor.TryEnter doesn't work

Part of my code-behind: object _sync = new object(); private async void OnKeyDown(object sender, KeyEventArgs e) { if (!Monitor.TryEnter(_sync)) return;

Dynamically add Image into asp.net c# gridview

I would like to display image inside a gridview. My gridview is being filled like This: Front: <asp:GridView ID="GridViewProduct" runat="se

Modifying Outlook 2010 autocomplete stream

I am accesssing the Outlook 2010 cache using the below code and modifying it. Please let me know how i can udpate the entry back to inbox mail store. Microsof

How to replace a char in string with an Empty character in C#.NET

I have a string like this: string val = "123-12-1234"; How can I replace the dashes using an empty string in C#. I mean val.Replace(char oldChar, newChar);

How to parse this json result without making class in C#

How can i parse this json without class in c#. I don't know what to use either an array or anything else. This is the json result i want to be parsed { "s

How to solve the error "Must use PackageReference"?

After adding WindowsRuntime to a WinForms-project, building the project fails with Error "Must use PackageReference". The build log is more precise: C:[...]\Vi