[Solved] How can I calculate difference between two dates? [duplicate]

Here, that should be easy private void Days() { DateTime dt1 = DateTime.Today; DateTime dt2 = DateTime.Today.AddDays(14); lbl_borroweddate.Text = dt1.ToShortDateString(); lbl_duedate.Text = dt2.ToShortDateString(); TimeSpan ts = dt2 – dt1; double days = (ts).TotalDays; } solved How can I calculate difference between two dates? [duplicate]

[Solved] On what objects we should use dispose method ? C# 4.0

If for some bizarre reason you don’t know at run-time if an object has dispose implemented, you can use this dispose-safe function: /// —- IsDisposable ——————————– /// /// <summary> /// returns true if an object is disposable, false if not /// you can optionally dispose of it immediately /// </summary> public static Boolean IsDisposable(Object Item, … Read more

[Solved] Error: System.IndexOutOfRangeException: Index was outside the bounds of the array [duplicate]

Your stringArray contains less than two elements.That is your problem, you need to make sure it contains at least two elements before switch statement.BTW, if you just want to append a dot to the end, you don’t need String.Split, just use Insert method: string str = row[“Version”].ToString(); str = str.Insert(str.Length, “.”); switch(str) { … } … Read more

[Solved] Can’t inside more than 1 time C++ [closed]

There are lots of mistakes in this code: All your variables voterid[10]; votername[30]; voteraddr[30]; phone[15]; age; status[20] are local to function analysis and function details. So the data you store in those variables from analysis function is not getting accessed in details. So, make those variables global. In analysis, you have put for statement at … Read more

[Solved] C++ cin don’t work properly [closed]

The line World(height, width); constructs a temporary object and discards it. The member variable of the current object never get initialized properly. Simplify your code. Move the code to get input data to the function that calls it. For example, use it in main. int width = -1; int height = -1; cout << “Aby … Read more

[Solved] How to find all elements in vector that are greater than certain number? [duplicate]

You would use a loop and access the amount member: #include <iostream> #include <vector> #include <string> struct Record { int amount; std::string name; }; static const Record database[] = { { 5, “Padme”}, {100, “Luke”}, { 15, “Han”}, { 50, “Anakin”}, }; const size_t database_size = sizeof(database) / sizeof(database[0]); int main() { std::vector<Record> vector1; // … Read more

[Solved] parse JSON using json.net c# [closed]

Step 1. Make some models (or Plain Old C# Classes if you like) to deserialize your json into (generated by http://json2csharp.com/) – this is generally a little bit easier to work with that straight up json: public class Customise { public string name { get; set; } public int id { get; set; } public … Read more

[Solved] Read strings into dynamically allocated array [closed]

It would be done musch simpler if you would use standard class std::string. If to speak about character arrays then the approach is to allocate a character array of a fixed size. When there will be entered more characters than the size of the array then reallocate the array increasing its size and copy elements … Read more

[Solved] Assorting linked list in c [duplicate]

Simplest will be bubble sort. item* sort(item *start){ item *node1,*node2; int temp; for(node1 = start; node1!=NULL;node1=node1->next){ for(node2 = start; node2!=NULL;node2=node2->next){ if(node2->draw_number > node1->draw_number){ temp = node1->draw_number; node1->draw_number = node2->draw_number; node2->draw_number = temp; } } } return start; } 1 solved Assorting linked list in c [duplicate]

[Solved] convert sql query into lambda expression [closed]

Query expression is much simpler in this case. I don’t recommend you to use lambdas with many joins from l in db.Listing join p in db.Place on l.PlaceId equals p.Id join pb in db.Place on p.ParentPlaceId equals pb.Id join a in db.Address on pb.AddressId equals a.Id where l.Id == 9 select new { UnitNumber = … Read more