VBScript Full Program for structure | Structure in VBScript

Before Writing a program for structure in VBScript we have to know what is a structure .? A structure is a generalization of the user-defined type (UDT) supported by previous versions of Visual Basic (VB). In addition to fields, structures can expose properties, methods, and events. A structure can implement one or more interfaces, and you can declare individual access levels for each field.


You can combine data items of different types to create a structure in VBscript. A structure link one or more elements with each other and with the structure itself. When you declare a structure in VBScript, it becomes a composite data type, and you can declare variables of that type.

Structures in VB Script are useful when you want a single variable to hold several related pieces of information. For example, you might want to keep a student’s name, telephone extension, and fee together. You could use several variables for this information, or you could define a structure and use it for a single student variable. The advantage of the structure becomes apparent when you have many students and therefore many instances of the variable.


Write a program for structures in VB Script


Here is a full VBScript Program for structure but if You Don’t Basics About Structures

we recommend you to check Basics First about Structures in VBScript  :


How to: Declare a Structure in VBScript
Shows how to declare a structure and its elements.

VB Script Structure Variables
Covers assigning a structure to a variable and accessing its elements.

VBScript Structures and Other Programming Elements
Summarizes how structures interact with arrays, objects, procedures, and each other.

VBScript Structures and Classes
Describes the similarities and differences between structures and classes.


Vbscript Program for Structure :

Imports System.Console

Module Module1

Structure student
Public rollno As Integer
Public name As String
Public Sub display()
WriteLine("The roll No. Is : " & rollno)
WriteLine("The Name is : " & name)
End Sub
Public Sub New(ByVal r As Integer, ByVal n As String)
name = n
rollno = r
End Sub
End Structure

Sub Main()
Dim x As Integer
Dim y As String
WriteLine("Enter Your Name : ")
y = ReadLine()
WriteLine("Enter Your Rollno. : ")
x = ReadLine()
Dim s1 As student = New student(x, y)

End Sub

End Module


OUTPUT of VB Script Program For Structure :

VBscript  program for structures.

Read More
admin January 18, 2014 0 Comments