• OK, it's on.
  • Please note that many, many Email Addresses used for spam, are not accepted at registration. Select a respectable Free email.
  • Done now. Domine miserere nobis.

Visual Basic

SpaceYeti

Prolific Member
Local time
Today 11:43 AM
Joined
Aug 14, 2010
Messages
5,592
---
Location
Crap
So, since I'm taking a Visual Basics class, I've been messing around with some programs just to help myself understand stuff a bit more. Two big things I desire to do are to have subroutines which, instead of being object based, are only called to from other routines, and I'm not sure how to set up a Sub like that, or would a Function be better, and if I need nothing returned, why bother with that? The second thing is, how would I store a bunch of different variables in a binary file, and then call them back somewhere else?
 

Grayman

Soul Shade
Local time
Today 10:43 AM
Joined
Jan 8, 2013
Messages
4,418
---
Location
You basement
For VB look up the Module. You can also declare functions as share make them available to other classes. Eventually you will have to at least declare and use an object because a lot of the framework is oop based.

Also properties are nothing but functions disguised as variables.
 

scorpiomover

The little professor
Local time
Today 6:43 PM
Joined
May 3, 2011
Messages
3,383
---
So, since I'm taking a Visual Basics class, I've been messing around with some programs just to help myself understand stuff a bit more.
Why are you taking a VB class? Are you sure that you don't mean VB.NET?

If you are taking a VB.NET class, are you taking them for the qualifications?

If you're paying for this class to learn, you're being fleeced. You can download Visual Basic for free. Then you can Ne-experiment to your heart's content. If you get stuck, just use Google. Almost every question you can think of at this stage, would be found on the internet (speaking from experience).

Two big things I desire to do are to have subroutines which, instead of being object based, are only called to from other routines, and I'm not sure how to set up a Sub like that,
As Grayman said, us a Module.

Start a new project. Right-click on the project, select Add, then Module. Then to make a subroutine called "test" with no parameters, add
Sub test()

End Sub

or would a Function be better, and if I need nothing returned, why bother with that?
Subs are void functions, i.e. functions that return nothing, and are thus used for when a VB programmer returns nothing.

The second thing is, how would I store a bunch of different variables in a binary file, and then call them back somewhere else?
No set method. You can serialise the data and save that to a file, in thousands of formats, put it in a database, write a CFG file, or write your own ways of saving and recalling data.

But it would help to start you off with basic file handling and basic database handling, and build up from there.
 

Grayman

Soul Shade
Local time
Today 10:43 AM
Joined
Jan 8, 2013
Messages
4,418
---
Location
You basement
What kind of data is being stored and for what purpose?
 

walfin

Democrazy
Local time
Tomorrow 2:43 AM
Joined
Mar 3, 2008
Messages
2,436
---
Location
/dev/null
1. Use a sub if you need nothing returned.

2. VB.NET, use the FileSystem object. VBA, use the old Open ___ For Binary as #___
 

Architect

Professional INTP
Local time
Today 11:43 AM
Joined
Dec 25, 2010
Messages
6,691
---
A surprising amount of code in the world is written in VB and still is.
 
Top Bottom