Home DotNet C#: How To Keep Your Window The Top Most of All Other Windows
Author:

In C# if you want to keep your windows application sits on top of all other windows screen then you could use the TopMost property. Here's is the sample code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TAW
{
    public partial class TAW : Form
    {
        public TAW()
        {
            InitializeComponent();
            this.TopMost = true;
        }
    }
}

C#: How To Compare Two DateTime Object

When working with calendar or the datetime information in C# we often need to perform a datetime comparison to see which date is larger then the other. Here's how you can do it:

To perform a comparison we need to use the static Compare method from the DateTime object DateTime.Compare(DateTime obj1, DateTime obj2).

The method will return the following value:

< 0   - obj1 is ealier then obj2.
= 0   - obj1 equals to obj2.
> 0   - obj2 is later then obj1.

'Send an email if the Meeting time is later then the current time.
'If mStart is later then Date.Now (current time) then do somethinng.
If (DateTime.Compare(mStart, Date.Now) > 0) Then
 client.Send(mail)
End If

 



Comments (0)
Write comment
Your Contact Details:
Comment:
Security
Please input the anti-spam code that you can read in the image.

"