Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. urgent

urgent

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    justintimberlake
    wrote on last edited by
    #1

    hello i want to create a directory from windows services my code is as below but is doesnt seems to do the work how can i do this. protected override void OnStart(string[] args) { Thread mythread= new Thread(new ThreadStart(Run)); mythread.Start(); } private void Run(){ System.IO.DirectoryInfo dI= new DirectoryInfo(@"c:/mydir/mysubdir"); if(!dI.Exists) { dI.Create(); } }

    J D 2 Replies Last reply
    0
    • J justintimberlake

      hello i want to create a directory from windows services my code is as below but is doesnt seems to do the work how can i do this. protected override void OnStart(string[] args) { Thread mythread= new Thread(new ThreadStart(Run)); mythread.Start(); } private void Run(){ System.IO.DirectoryInfo dI= new DirectoryInfo(@"c:/mydir/mysubdir"); if(!dI.Exists) { dI.Create(); } }

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      First of all, please use a descriptive topic for your post next time, instead of "urgent". You'll likely get more replies if you stick with a descriptive topic. In order to help you diagnose your problem, can you tell us what isn't working? Have you setup a debug breakpoint in the code to see whether the directory already exists?

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: God-as-Judge, God-as-Forgiver The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      1 Reply Last reply
      0
      • J justintimberlake

        hello i want to create a directory from windows services my code is as below but is doesnt seems to do the work how can i do this. protected override void OnStart(string[] args) { Thread mythread= new Thread(new ThreadStart(Run)); mythread.Start(); } private void Run(){ System.IO.DirectoryInfo dI= new DirectoryInfo(@"c:/mydir/mysubdir"); if(!dI.Exists) { dI.Create(); } }

        D Offline
        D Offline
        dbetting
        wrote on last edited by
        #3

        Turn the slashes the right way. System.IO.DirectoryInfo dI= new DirectoryInfo(@"c:\mydir\mysubdir");

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups