Updating understanding ?

luminosity
06-07-2005, 12:00 AM
In qb you used to be able to directly use subs with calling and it would just run down the code in a top down method.

Is their a way to use subroutines in visual basic in the same way?

I have been reading about standard modules but I have not seen any information about it really.

I have tried every thing except for directly defining the variables that should be passed to the program in a function.

I also tried call but it said their is a module in the project but it is not a variable.

Yet I want it to be the module and not the variable.


I know the code does not have option explicit which it should but I know the program does not have everything define, and I want the program to function
as it is. Which it does with the last version that does not divide the main code into modules.

Yet I wanted to possibly eventually let this program interact with a sql database so that the players of the game can be able to share info and play with each others information.

So every one can see other peoples monsters and classes, skills, races equipment, ect.

So that in can grow not just in the way that I dream the game but also as other people dream it.

It has been my goal to provide a cheap solution to playing paper and pencil rpgs since I would like people that do not have allot of money to still get allot of enjoyment out of their lives.

I know that it can be hard to do sometimes when you are broke.

The project is attached.


That and if you have some really good and simple vb tutorials I would love to see them.

I have found lots of good information on the net in msdn yet it does not always match what I am thinking of or how I am trying to implement my code.
Thank you for your help.

Other goals for the program.
Fill in the character information
Make program extensible
Modularize program
Reduce redundancy
Graphic user interface improvements

Long term goal
Prep program for database connection
Account creation
Document uploading
Html formatting


Eventually one thing at a time though.

unclebill
06-07-2005, 12:10 AM
From reading your question, I think what you want is under the Tools menu and is the Add Procedure option.

You then select if you want the procedure to be a Sub or a Function. Construct the code you need and the last line is End Sub/Function as appropriate.

As in QuickBASIC, a Function may be used to the right of the = operator.

Gruff
06-07-2005, 01:50 AM
Creating a top down program in VB6 is simple. You can write your sub routines and functions in the form code window. Just give it one button to click to start your code on the form. Your video routines will most likely have to be updated to VB6 as the old qbasic drawing commands will not process. (Far as I know.)

Picturebox controls or a form surface itself can host graphical drawing.

If your looking at converting an old program then you will need to understand more about VB6.

wakjah
06-07-2005, 03:46 AM
What I understand your problem is from your question is that you are having trouble calling methods.

A subroutine is called as follows:

mySubroutine myParameter1, myParameter2, ..., myParameterN

Simple as that

Diurnal
06-07-2005, 07:43 AM
You've got a lot of things going on in your post.

To begin, use Option Explicit. It doesn't matter what you are doing, there is no reason to not let the VB environment work for you.

As far as the code you posted goes I have several observations.

First, a form is used to host controls and is a visual reference for your program. Subroutines that deal with controls on a form should be written in the form's code winddow. The exception to this is if a routine is generic and can be applied to more than one form. An example would be a printing routine. You may pass in a reference to controls on any form and your sub might print out some data from those controls.

Second, modules are not places to store mass amounts of variables. Sometimes it is a neccessity to use global scoped variables in a project and a module provides a place for this. In your case, the decalarations you have made are only seen by the routine they are in and essentially are not available to any routine in the program.

Finally, you are on the right track to modularize. This can be accomplished using standard modules as you have done as well as class modules. I think you just need some more thought in laying out your project. I would start with something simple and expand. You have concentrated on the details and ,while important, they can be filled in later.

At this point, my suggestion is to browse the Knowledge Base (http://www.xtremevbtalk.com/forumdisplay.php?f=44) looking for specific help in writing your code. Start with the Top Ten Tutorials (http://www.xtremevbtalk.com/showthread.php?t=145169). There is tons of information on this site.

TeraBlight
06-07-2005, 08:07 AM
Your video routines will most likely have to be updated to VB6 as the old qbasic drawing commands will not process.

Actually, the syntax of the PSet (draw a point) and Line methods has been deliberately kept unchanged in Visual Basic to be, in this respect, backwards compatible to QBasic (and even GWBasic).
This being the reason why especially the Line command seems very odd in the VB context, it takes parameters in a totally different way from almost all other inbuilt functions and methods.

luminosity
06-09-2005, 08:01 PM
From reading your question, I think what you want is under the Tools menu and is the Add Procedure option.

You then select if you want the procedure to be a Sub or a Function. Construct the code you need and the last line is End Sub/Function as appropriate.

As in QuickBASIC, a Function may be used to the right of the = operator.


although this is not what I was getting at.
its nice to know that thing exists.
when you generally just draw and type in vb you miss some of the ide features.
heh.

luminosity
06-09-2005, 08:03 PM
Creating a top down program in VB6 is simple. You can write your sub routines and functions in the form code window. Just give it one button to click to start your code on the form. Your video routines will most likely have to be updated to VB6 as the old qbasic drawing commands will not process. (Far as I know.)

Picturebox controls or a form surface itself can host graphical drawing.

If your looking at converting an old program then you will need to understand more about VB6.
I also thought this was a good thought.

It works for some programs infact with msgbox and input box it would work just fine for something I am fooling around with.

luminosity
06-09-2005, 10:47 PM
You've got a lot of things going on in your post.

To begin, use Option Explicit. It doesn't matter what you are doing, there is no reason to not let the VB environment work for you.

As far as the code you posted goes I have several observations.

First, a form is used to host controls and is a visual reference for your program. Subroutines that deal with controls on a form should be written in the form's code winddow. The exception to this is if a routine is generic and can be applied to more than one form. An example would be a printing routine. You may pass in a reference to controls on any form and your sub might print out some data from those controls.

Second, modules are not places to store mass amounts of variables. Sometimes it is a neccessity to use global scoped variables in a project and a module provides a place for this. In your case, the decalarations you have made are only seen by the routine they are in and essentially are not available to any routine in the program.

Finally, you are on the right track to modularize. This can be accomplished using standard modules as you have done as well as class modules. I think you just need some more thought in laying out your project. I would start with something simple and expand. You have concentrated on the details and ,while important, they can be filled in later.

At this point, my suggestion is to browse the Knowledge Base (http://www.xtremevbtalk.com/forumdisplay.php?f=44) looking for specific help in writing your code. Start with the Top Ten Tutorials (http://www.xtremevbtalk.com/showthread.php?t=145169). There is tons of information on this site.


this is certainly what I wanted to here

I actually have a working version of every thing except for the modules.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum