Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
QuestionChange SQL Server dateformat? Pin
Dotnetkanna19-May-10 22:44
Dotnetkanna19-May-10 22:44 
AnswerRe: Change SQL Server dateformat? Pin
Hristo-Bojilov19-May-10 22:55
Hristo-Bojilov19-May-10 22:55 
AnswerRe: Change SQL Server dateformat? Pin
T M Gray20-May-10 11:44
T M Gray20-May-10 11:44 
QuestionCreating Tables in Run time using c# Pin
Raghu_M19-May-10 22:33
Raghu_M19-May-10 22:33 
AnswerRe: Creating Tables in Run time using c# Pin
Pete O'Hanlon19-May-10 23:25
mvePete O'Hanlon19-May-10 23:25 
Questionhow to check operating system in c#..? Pin
NetMan201219-May-10 22:07
NetMan201219-May-10 22:07 
AnswerRe: how to check operating system in c#..? Pin
The Man from U.N.C.L.E.19-May-10 22:18
The Man from U.N.C.L.E.19-May-10 22:18 
AnswerRe: how to check operating system in c#..? Pin
Pete O'Hanlon19-May-10 22:30
mvePete O'Hanlon19-May-10 22:30 
You can use Environment.OSVersion to get the OperatingSystem back. From this you can determine whether or not it's a Vista+ system with a simple check:
public bool IsVistaOrHigher
{
  get { return OSVersion.Version.Major >= 6);
}
If the application can run in compatibility mode though, this is potentially unreliable. Another way to do this is to use a method that only exists in a Vista (or greater) OS to determine it. Here's another example that demonstrates it:
public bool IsVistaOrHigher
{
  get
  {
    return IsVistaOrHigherHelper();
  }
}

private bool IsVistaOrHigherHelper()
{
  IntPtr hModule = LoadLibrary("Kernel32.dll");
  if (hModule != null)
  {
    IntPtr proc = GetProcAddress(hModule, "MoveFileTransactedA");
    return proc.ToInt32() != 0;
  }
  return false;
}
I used part of the Kernel Transaction Manager (KTM) to do this - you can use any new API to accomplish the same.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



AnswerRe: how to check operating system in c#..? Pin
Johnny J.19-May-10 22:33
professionalJohnny J.19-May-10 22:33 
AnswerRe: how to check operating system in c#..? Pin
Dave Kreskowiak20-May-10 1:29
mveDave Kreskowiak20-May-10 1:29 
AnswerRe: how to check operating system in c#..? Pin
Luc Pattyn20-May-10 3:00
sitebuilderLuc Pattyn20-May-10 3:00 
GeneralRe: how to check operating system in c#..? Pin
Pete O'Hanlon20-May-10 3:36
mvePete O'Hanlon20-May-10 3:36 
GeneralRe: how to check operating system in c#..? Pin
Luc Pattyn20-May-10 3:55
sitebuilderLuc Pattyn20-May-10 3:55 
GeneralRe: how to check operating system in c#..? Pin
Pete O'Hanlon20-May-10 3:59
mvePete O'Hanlon20-May-10 3:59 
GeneralRe: how to check operating system in c#..? Pin
Dave Kreskowiak20-May-10 6:35
mveDave Kreskowiak20-May-10 6:35 
GeneralRe: how to check operating system in c#..? Pin
Johnny J.20-May-10 21:01
professionalJohnny J.20-May-10 21:01 
GeneralRe: how to check operating system in c#..? Pin
Dave Kreskowiak21-May-10 1:45
mveDave Kreskowiak21-May-10 1:45 
AnswerRe: how to check operating system in c#..? Pin
canangirgin20-May-10 4:41
canangirgin20-May-10 4:41 
QuestionDisposing of object used in a UserControl... Pin
Shy Agam19-May-10 21:40
Shy Agam19-May-10 21:40 
AnswerRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon19-May-10 22:11
mvePete O'Hanlon19-May-10 22:11 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn20-May-10 3:20
sitebuilderLuc Pattyn20-May-10 3:20 
GeneralRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon20-May-10 3:50
mvePete O'Hanlon20-May-10 3:50 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn20-May-10 4:00
sitebuilderLuc Pattyn20-May-10 4:00 
GeneralRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon20-May-10 4:03
mvePete O'Hanlon20-May-10 4:03 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn20-May-10 4:05
sitebuilderLuc Pattyn20-May-10 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.