Question about Computers & Internet

2 Answers

Global declaration syntax in vb

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

Posted by on

2 Answers

  • 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

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

Posted on Aug 19, 2008

  • 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

See my answer here.

Posted on Aug 19, 2008

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

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

×

Loading...
Loading...

Related Questions:

1 Answer

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..

Feb 23, 2014 | Casio FX9750GII Graphic Calculator

1 Answer

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

Mar 15, 2011 | Computers & Internet

1 Answer

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.

Feb 27, 2011 | Computers & Internet

1 Answer

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!

Dec 11, 2010 | Computers & Internet

1 Answer

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

Oct 27, 2010 | Computers & Internet

1 Answer

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

Jun 04, 2009 | Computers & Internet

2 Answers

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

Apr 30, 2009 | Computers & Internet

1 Answer

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.

Aug 18, 2008 | Computers & Internet

1 Answer

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.

May 08, 2008 | Computers & Internet

2 Answers

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.

Feb 20, 2008 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

352 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

101642 Answers

David Payne
David Payne

Level 3 Expert

14160 Answers

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

Answer questions

Manuals & User Guides

Loading...