Computers & Internet Logo

Related Topics:

Posted on Aug 18, 2008
Answered by a Fixya Expert

Trustworthy Expert Solutions

At Fixya.com, our trusted experts are meticulously vetted and possess extensive experience in their respective fields. Backed by a community of knowledgeable professionals, our platform ensures that the solutions provided are thoroughly researched and validated.

View Our Top Experts

Global declaration syntax in vb

If we want to initialize a variable globally,then wat is the syntax in vb?

2 Answers

Anonymous

Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Champion:

An expert who has answered 200 questions.

Governor:

An expert whose answer got voted for 20 times.

  • Expert 214 Answers
  • Posted on Aug 19, 2008
Anonymous
Expert
Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Champion:

An expert who has answered 200 questions.

Governor:

An expert whose answer got voted for 20 times.

Joined: Jun 13, 2008
Answers
214
Questions
0
Helped
42995
Points
490

Hi,
for initializing a variable globally, add a module to the project and open the code window for the module.
Add the variable in the following syntax
public <variable name> as <type>
example
public a1 as integer


thank you

Anonymous

Level 1:

An expert who has achieved level 1.

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Mentor:

An expert who has written 3 tips or uploaded 2 video tips.

  • Contributor 51 Answers
  • Posted on Aug 19, 2008
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Mentor:

An expert who has written 3 tips or uploaded 2 video tips.

Joined: Feb 22, 2008
Answers
51
Questions
0
Helped
98012
Points
73
Ad

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

0helpful
1answer

How to write long programs after using all alpha keys memory with casio fx 9750Gii

I believe you must rethink the design of your program
If you have several inputs that lead to a single result you want to keep for further calculations, enter the inputs, calculate your result and store in a variable. The intermediate variables can be set to zero (by precaution) and reused.
Use functions, and subroutines. Usually, in well designed programs, the scope of a variable defined inside a function or subroutine is local :It can't collide with the same name used globally (global scope). If a variable is no longer needed destroy it and reuse it..
0helpful
1answer

How to connect MS access in the visual basic?

This following code to connect vb 6 with access
place this code in module :
vb Syntax
  1. Global Conn As ADODB.Connection
  2. Global rs As ADODB.Recordset
  3. Sub Access_Connector()
  4. Set Conn = New ADODB.Connection
  5. Conn.Provider = "microsoft.jet.oledb.4.0"
  6. Conn.CursorLocation = adUseClient
  7. Conn.Open App.Path & "\SIS.mdb"
  8. End Sub
Below link might help you... http://www.functionx.com/vbaccess/Lesson01.htm

Please rate or vote me , if you like solution..

Thanks
sandeep
0helpful
1answer

I declared a variable, but when I try to compile it it says my variable might not have been initialized. What could I be doing wrong?

You need to assign a default value to your variable, otherwise it's just declared and not initialized.
Example (in C#):
int numericValue; Here the variable numericValue has been declared as an integer
int numericValue = 11; and here the variable has been declared and initialized as an integer with the value 11.
0helpful
1answer

Why do we need to declare variables?

Hi,
I'm assuming you are referring to declaring variables in Procedural programming languages such as Java. Variables need to be declared for several different reasons, some of which include helping the computer reserve space in memory for variables to be stored and it also plays a part in the various stages of converting the source code, i.e. the code that you type in VB or Java, into machine code which is a series of binary digits that the computer can actually understand. It helps the computer in debugging the code for errors. In the first stage of code conversion, lexical analysis, information about the variable names is stored. In the next stage, Syntax analysis, the code is checked to be grammatically correct according to the rules of Backus Naur Form, i.e. if a key word such as PRINT is typed in as PLINT the computer will treat this as a variable name and since no information about this variable name has been entered in the lexical analysis stage it knows that an error has been made.
Hope this helps!
0helpful
1answer

A reference variable must be initialized at the time of declaration. when we call a function by reference then why we do not need to initialize reference variable. for example- void f(int &a) { ...

You have posted in the wrong section.
This is for computer help / operating systems.
If you post in the right section, you may get some help.
Good luck
0helpful
1answer

How to declare and initialize variables in java

well there is not much difference there.the difference is in the data types not in declaration
0helpful
2answers

Please send me the code to link two forms of a project file...actually i wanted to to transfer a variable value from one form to another...please forward code as soon as possible

if this is vb 6 then you should be able to access the other variable by using the other forms name so if you are in form1 and want to access a variable in form2

form2.variable_name

and visa versa

If this is another language then it may differ
0helpful
1answer

Visual basic basics

In a code module, use this form:

Global <variable> as <Type>

eg:

Global varVar as Variant
Global intVar as Integer

Take a look at this.

Public is now preferred over Global, but VBA will take both. Don't know about VB itself, try it and see.
0helpful
1answer

Boolean Logic

I don't know the syntax but you could easily do this with setting the switches to a constant, then adding them up. The number set would need to be something so that there would only be one solution...the one that you were looking for.

sw1 = 1
sw2 = 2
sw3 = 4

If sw1 and sw2 is both on, but sw3 is off, the number would be 3
If sw2 and sw4 was on, the number would be 6
If all were on, the number would be 7, etc.
0helpful
2answers

Visual Basic 6.0

1. IDE is Integrated Development Environment
2.With VB 6, one can develop applications with feature rich GUIs (Graphical User Interface). Many varieties of general purpose software can be created with little effort, including, but not limited to, image editing software, text editor and database applications.
3.Windows Application Template
-----------------------------------------------------
Used to create Windows-based applications that run locally on users' machines. You can build anything from a simple single-window tool like Windows Calculator to a complete application with multiple windows and advanced capabilities.

Class Library Template
-----------------------------------------
Used to create reusable classes or components that can be shared with other projects.

Console Application Template
----------------------------------------------------
Used to create command-line applications, programs that run from a Windows command prompt and have no visual interface.

My Movie Collection Starter Kit Template
-------------------------------------------------------------------------
Used to create the pre-built My Movie Collection sample application, which you can customize to meet your own needs. For more information, see Starter Kits: Getting Up and Running Quickly.

Screen Saver Starter Kit Template
-------------------------------------------------------------
Used to create the pre-built Screen Saver sample application, which you can customize to meet your own needs. For more information, see Starter Kits: Getting Up and Running Quickly.
4.FormShaper lets you change the shape that windows draws your forms. You can have rectangles, rounded rectangles, ellipses, polygons and any combination of the above! Even save the shapes to a file for use in other projects! See readme.txt in the zip file for more details

5.Description
Used at script level to force explicit declaration of all variables in that script.
Syntax
------------
Option Explicit
Remarks
----------------
If used, the Option Explicit statement must appear in a script before any procedures.
When you use the Option Explicit statement, you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variable name, an error occurs.
--------------------------------------------------------------------------------

Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear.
Not finding what you are looking for?

391 views

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3867 Answers

Brad Brown

Level 3 Expert

19187 Answers

Cindy Wells

Level 3 Expert

6688 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...