VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need some help on a very simple application. Posted by Hekmat on 15 Jun 2007 at 10:17 AM
Hey all,

I understand this forum isn't really meant as a training ground for new programmers, but I can't find the answer to my question online or any of my textbooks so I figured a forum post was worth a shot. Any help is much appreciated.

My university teacher told the class to use the internet to find out the best method to make our code. Just mentioning this so that people don't think i'm trying to cut short my work ;) .

Basically I need to make a program that allows the user to select one of a set of DOS commands from a ComboBox, and then displays the output in an RichTextBox. My problem is that I don't know how to run dos commands through VB .NET.

For example, Lets say the user desires to run the dir command. The program should then display the contents of the directory inside the TextBox. From what I've managed to find online, I'm supposed to use the 'Process' Class to do this, but i've no idea how.

If anyone could give me an idea of what to do I'd really appreciate it, thanks.
Report
Re: Need some help on a very simple application. Posted by seancampbell on 15 Jun 2007 at 11:12 AM
Well... I have not ever tryed to run a dos command from vb.net and capture its output but I did read this article just now:

http://vb-helper.com/howto_net_run_dos.html

If you want to select the command from a richtextbox, consider writing code that generates a batch file (text file with dos commands in it named .bat) and then after it's created call it with the code mentioned in that article.

The Software I wrote for my work writes batch fles at run time and then executes them to perform dos actions.
Report
Re: Need some help on a very simple application. Posted by jammer2552 on 6 Jul 2007 at 11:57 PM
If you're using VB.NET 2005, you can mimic the DOS commands. For example, the 'dir' command:
Dim SubDirs as String() = System.IO.Directory.GetDirectories("C:\WINDOWS")
For Each s As String In SubDirs
    ListBox1.Items.Add(s)
Next
 


... simple as that!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.