Solved

VB5 Console Apps

Posted on 1998-08-10
5
192 Views
Last Modified: 2010-04-30
I read somewhere that you can write a program in VB5 which will run in a DOS window as a console application.  If anyone can verify this fact for me, and possibly point me to some source code or provide a simple source code to do this task, I would appreciate it.
0
Comment
Question by:codewizard
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:cantrell
ID: 1468497
About the only thing I know of that would do that is VB for Dos 1.0. I have it if you want. I don't use it anymore and you are welcome to it. I don't think that breaks any laws...
0
 

Author Comment

by:codewizard
ID: 1468498
I have that, but I'm looking to write a 32-bit console application to run from a DOS window.  I've read on a website that it is possible to do it.  I was just hoping someone out there can provide some sort of information or hint on how to do it.  That's all I'm looking for.

Thanx cantrell, but I already have that program along with QB4.5, but they can't create 32-bit programs.

0
 
LVL 2

Accepted Solution

by:
cantrell earned 20 total points
ID: 1468499
I've never seen this, and I've asked other programmers here and they haven't either. However, you can use the print method after autoredraw=true with only one form and that will work in a form.


0
 

Author Comment

by:codewizard
ID: 1468500
I guess no one here knows of it.  I've read on a site about it.  When I get the address, I will post it here and maybe an expert might be able to get an answer from this guy who claims that its possible.
0
 
LVL 2

Expert Comment

by:cantrell
ID: 1468501
Ok, here is your definative answer for writing a console app in VB...

To create a VB program that has only console input and output -- that is, no dialog boxes or forms -- you can use the Main procedure. Begin by creating a new project. Open a code window, then choose Insert | Procedure…. In the Insert Procedure dialog box, Select the Sub and Public options and enter Main in the Name box. Click OK to create a new Main subroutine in the General object. All your code will go in this routine; if you have any useful BAS modules, you can add those to the project as well.
VB needs to know what code to execute when your application is called. Since you're not using a form, you need to tell VB to start execution with Sub Main. To do so, choose Tools | Options…. Click the Project tab and select Sub Main from the Startup Form list. To remove the project's default form, right-click on it in the Project window and choose Remove File from the speed menu.
Testing a formless application can be a headache, so plan ahead: Use a log file to get debug messages from your application. You'll want to read about the Print # statement in VB's Help file, along with Open and Close.
Note that you can use this method to create a VB application that will run as a service on NT. (Services can't have any forms or dialog boxes.)

Enjoy,
Cantrell
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question