Results 1 to 3 of 3

Thread: Couple of .NET questions

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Couple of .NET questions

    I have a question. My program is setup to change registry entries but if a computer doesn't have the registry entry I'm trying to change, I get a nasty error about it not being there. I wanted to know how I would go about checking to see if there is a registry entry there and if it wasn't there, I would just hide the controls that modify that entry so no one would get error messages.

    I also wanted to know how to move and rename files. I know how to do it via command prompt and tried to do that in VB with the process.start("commands") but it doesn't work. When I try to rename a file that exists in a certain directory, then copy a file in the same folder as my program, it says it cannot find the file. What would be the best way to copy files form the local folder to another folder?

    Incase you're wondering, I'm setting up a program to get Windows the way I like it without doing everything manually so when my computer or any other computers need to be formatted, I can run this program and fix it all up the way I need it.

    Thanks. I searched and didn't find anything.

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Couple of .NET answers

    I have a question. My program is setup to change registry entries but if a computer doesn't have the registry entry I'm trying to change, I get a nasty error about it not being there. I wanted to know how I would go about checking to see if there is a registry entry there and if it wasn't there, I would just hide the controls that modify that entry so no one would get error messages.
    There should be a way but I dont remember anything ooffff my head... easiest way is to put it in a try...catch block and check for that specified error in a catch block. Simple and not too bad

    I also wanted to know how to move and rename files. I know how to do it via command prompt and tried to do that in VB with the process.start("commands") but it doesn't work. When I try to rename a file that exists in a certain directory, then copy a file in the same folder as my program, it says it cannot find the file. What would be the best way to copy files form the local folder to another folder?
    take a look at the System.IO namespace... some random answers:
    look at system.io.file.Copy() and file.move()
    I'm not aware of an easy function to rename files... search

    edit: aaah what am I thinking, use the move function for renaming files
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    For the setup thing , you can use Setup and Deployment project to create condition where it checks for specific reg key whether it contains that value or not .

    For the renaming and moving of files , see this little demo .
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width