Results 1 to 15 of 15

Thread: Newbie and his idea!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Newbie and his idea!

    Hi All,

    I'm preparing to construct my first VB creation and I'm hoping some experienced members can humour me and provide insight into what will be a simple program. After having a better idea of how my program will work, I can go away and build it.

    Anyway...

    I have databases that routinely need archiving. I'm sure its not going to be difficult to build an interface to run a command line tool to archive and then re-name the file with the appropiate date and time. That's great for one-time archiving, but I would like the user to be able to schedule this archiving too. My question is, is it possible to have the program still archive a database after the program itself has been closed down? Also is it to ensure the program performs it tasks in the event the PC is re-started?

    At the moment I've just created some simple batch scripts that I run using Windows task scheduler, but I would like to creat something that is a lot more user friendly and can be used simply and universally by my colleagues.

    One more question, possibly stupid ha! If I wanted to use 7-zip command line tool and this may not necessarily be on a PC to call, is it possible to encapsulate (for lack of a better word) this in a program for the program itself to use or distribute for use?

    I've never programmed in anything similar before, so I'm just really trying to pick the right poeple's brains and understand what is possible or to be put in the right direction!

    Thanks for taking the time to read and I look forward to any input!

  2. #2
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: Newbie and his idea!

    Quote Originally Posted by Oreos View Post
    Hi All,

    I'm preparing to construct my first VB creation and I'm hoping some experienced members can humour me and provide insight into what will be a simple program. After having a better idea of how my program will work, I can go away and build it.

    Anyway...

    I have databases that routinely need archiving. I'm sure its not going to be difficult to build an interface to run a command line tool to archive and then re-name the file with the appropiate date and time. That's great for one-time archiving, but I would like the user to be able to schedule this archiving too. My question is, is it possible to have the program still archive a database after the program itself has been closed down? Also is it to ensure the program performs it tasks in the event the PC is re-started?

    At the moment I've just created some simple batch scripts that I run using Windows task scheduler, but I would like to creat something that is a lot more user friendly and can be used simply and universally by my colleagues.

    One more question, possibly stupid ha! If I wanted to use 7-zip command line tool and this may not necessarily be on a PC to call, is it possible to encapsulate (for lack of a better word) this in a program for the program itself to use or distribute for use?

    I've never programmed in anything similar before, so I'm just really trying to pick the right poeple's brains and understand what is possible or to be put in the right direction!

    Thanks for taking the time to read and I look forward to any input!
    What kind of database are you backing up? I am guessing a file-based database like Access. I implemented something like this in one of my work programs. Essentially, I use a timer with a 60000(1 minute) interval and a Boolean flag. Once the timer tick event occurs (every minute) I use the tick event to then check current time and check a Boolean flag indicating whether the report has already been run. The Boolean flag gets changed to true after the code runs.

    The above I think is kind of the implementation you are seeking. The only downside to the above is that the form needs to be open and displayed on the screen (It is not running as a service) so you need to have the computer logged-in (computer can be locked). If this is not a deal-breaker for you, you can customize the form to reflect the parameters you define in your code.

    If you want to use 7ZIP in .NET, you can take a look at:
    https://sevenzipsharp.codeplex.com/

    If you are just looking for ZIP needs and don't care about using that specific software, I have had success with dotnetzip. http://dotnetzip.codeplex.com/

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Hi Jay,

    Thanks for your response! I think I understand your idea with regards to scheduling your report. For my archiving, I would like the user to be able to open an interface and select a "start date and time" and then perhaps to be able to select one of several options relating to the frequency of the archiving (one-time, daily, weekly, monthly). Once this has been set by the user, I would like them to be able to close the form but still have the archiving run at the set frequency no matter what user is logged in and whether the computer has been re-started etc. I hope this gives everyone a better idea of what I'm trying achieve and can point me in the right direction if this is possible?

    Thanks for the links too. Those are exactly what I'm looking for with reference to the actual archive function itself!

    Looking forward to more responses as there has been some great knowledge from this first response!

  4. #4
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: Newbie and his idea!

    Quote Originally Posted by Oreos View Post
    Hi Jay,

    Thanks for your response! I think I understand your idea with regards to scheduling your report. For my archiving, I would like the user to be able to open an interface and select a "start date and time" and then perhaps to be able to select one of several options relating to the frequency of the archiving (one-time, daily, weekly, monthly). Once this has been set by the user, I would like them to be able to close the form but still have the archiving run at the set frequency no matter what user is logged in and whether the computer has been re-started etc. I hope this gives everyone a better idea of what I'm trying achieve and can point me in the right direction if this is possible?

    Thanks for the links too. Those are exactly what I'm looking for with reference to the actual archive function itself!

    Looking forward to more responses as there has been some great knowledge from this first response!
    Why don't you look at handling this on a server rather than a desktop? Let the user change the configuration from their desktop, and have the server constantly check to see what it needs to do. Otherwise I think you will have to look at running a windows service for all users. I however, have not needed to do that yet so I am unfamiliar with the latter.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    I'm not handling one system. I'm usually on different systems (projects) in the office or on various customer sites, so I'm looking to creat a portable application that I or others can use anywhere for backing up these various project databases. I'll have a look at Windows services as you suggest.

    To others as well, please field any suggestions or thoughts. I'm alien to this, so a big part of this exercise is understanding what I can actually do. If you have any thoughts as to what I'm trying to achieve, then please post.

    Many thanks!

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Another thought that I would like to confirm... Say the user specified a folder to archive and where to place it, and I had a "Run" button that executed the archiving according to the settings... Is it possible to schedule a task using windows task scheduler to run that aspect of the program i.e. to process the code behind the "Run" button?

    I'm thinking that if my program cas ask the user for the occurrence/frequency of the archiving than possibly I can use this information to create a scheduled task and process the code resposible for the archiving. Has anyone done anything similar or know if it is possible to do this?

    Thanks again for any responses!

  7. #7
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: Newbie and his idea!

    I highly doubt you are going to get very many responses because you have shown no effort to really research and implement what you are trying to do. No one here is just going to instantly give you a thread full of answers without you having a basic understanding of what you are trying to do.

    In just one google search I came across articles:

    http://www.codeproject.com/Tips/6456...ws-with-VB-NET
    http://www.codeproject.com/Tips/6068...Task-Scheduler
    http://stackoverflow.com/questions/2...k-using-vb-net
    http://www.vbforums.com/showthread.p...Task-from-code

    Why dont you do some more research, build some code, then show us what didnt work and what you expected to happen. If you really want to make this happen, you will need to research, read, and read some more. With that being said, I will leave you to it and maybe someone else will respond.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Honest response. I'm just trying to build a picture in my mind of what a solution might be so that I can attempt it. But I think I've got that now, so I'll try to build something and pop back if I stumble. Sure I will ha! Your posts/link sharing has been helpful

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Hi All, so I've created a form this evening. I've used a "FolderBrowserDialog" to allow the user to selct a path and display the path in a textbox. Next I want to display the contents of the path in a listbox as a list of folder names. I've tried the following from within the listbox:

    Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
    For Each folder As String In My.Computer.FileSystem.GetDirectories("C:\")
    ListBox1.Items.Add(System.IO.Path.GetFileName(folder))
    Next
    End Sub

    Where "C:\" I originally tried the string entered in the textbox ("TextBox2.text") but I couldn't get anything to display in the listbox. So I fellback and tried to list everything under my c drive, but still no luck. I've tried some other solutions found on the net, but again no luck. Can anybody help out with what is wrong with this code or what I should be doing?

    Many thanks!

  10. #10
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Newbie and his idea!

    Please post code inside code or highlight tags. You mentioned the folder browser dialog but where do you use it above? All i see you doing is using which is clear to your self Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged is gettinga new collection every time you change listboxes selected item.

  11. #11

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Quote Originally Posted by ident View Post
    Please post code inside code or highlight tags. You mentioned the folder browser dialog but where do you use it above? All i see you doing is using which is clear to your self Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged is gettinga new collection every time you change listboxes selected item.
    The folder browser dialog doesn't matter. It works. I was just stating that I actually acheived something ha! With the code that I published I'm trying to display all of the folder names under "C:\" (in that case, but long term it will display all of the folder names under the path that the user browed to) but when I run the program the listbox displays nothing. So I need help with displaying all of the folder names in a directory specified by the user. Hope that makes things more clear.

  12. #12
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Newbie and his idea!

    Your code is not doing any thing other then displaying the same folder over and over again so don't break out the champagne just yet. You also jump from the Io namespace to My. Don't. Pick One and stay that way. I'd advise you to use only IO how ever there is no bad from using My. Just keep consistent.

    You only add the file name. How does the list view know it's location by a file name?

  13. #13

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Believe me I know I've created not much except an empty form ha, so the champagne is definitely still on ice! I think I'm definitely going to have to go away and learn the basics so that I can communicate myself much better. I'm just sort of diving in here. I'll spare you from anymore simple questions and find the time to do some reading. Is there any good resources/books that you'd personally recommend?

  14. #14
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Newbie and his idea!

    But you are thinking not in baby steps. Why are you worried about the end? What is the first thing you wish to do. Display the contents of the FBD chosen directory path. Correct?

    Please stop worrying about the whole project and focus on the first step you wish. Im here helping you. I'm not or this forum is go0ing any where. Please take your time posting. Remember we don't know your mind. We are not magical and can see what you really want. In other words. POST STUPID AMOUNTS IF NOT OVER THE TOP INFORMATION. oK?

  15. #15

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Posts
    14

    Re: Newbie and his idea!

    Ha, you're right! On all accounts. Most importantly about the first step. That is to display the contents of the FBD in the listbox, so all of the folder names under that path. I defintely need to learn some of the basics though, as I'm just trying to accomplish this task by searching for examples but if it doesn't work and I'm asked about different namespaces (ha) I wouldn't yet know how to answer properly. So I'll definitely try and brush up of the next couple of days so that I can converse with everyone properly!

    But yes, you're right in where I would like to begin... So can you explain where the code I found goes wrong and then I can go away and try to correct it? Thanks for you help and sticking with this a little ah!

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