VERSION 5.00 Begin VB.UserControl UserControl1 BorderStyle = 1 'Fixed Single ClientHeight = 3555 ClientLeft = 0 ClientTop = 0 ClientWidth = 2445 ScaleHeight = 3555 ScaleWidth = 2445 Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00000000& BorderStyle = 0 'None ForeColor = &H80000008& Height = 2775 Left = 0 ScaleHeight = 2775 ScaleWidth = 2415 TabIndex = 0 Top = 0 Width = 2415 Begin VB.Label Label1 BackColor = &H00000000& Caption = "Processing..." BeginProperty Font Name = "MS Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FFFFFF& Height = 255 Left = 360 TabIndex = 1 Top = 645 Width = 1095 End Begin VB.Shape Shape1 BackColor = &H00000000& BackStyle = 1 'Opaque BorderColor = &H00000000& FillStyle = 0 'Solid Height = 1425 Left = 340 Shape = 3 'Circle Top = 40 Width = 1215 End End End Attribute VB_Name = "UserControl1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Public Enum scrollingconstant ccScrollinStandard = 0 ccScrollingSmooth = 1 End Enum 'Default Property Values: Const m_def_max = 100 Const m_def_min = 0 Const m_def_value = 0 Const m_def_Scroll = 0 'Property Variables: Dim m_max As Integer Dim m_scroll As Integer Dim m_min As Integer Dim m_value As Integer 'Event Declarations: Event Click() 'MappingInfo=UserControl,UserControl,-1,Click Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object." Event DblClick() 'MappingInfo=UserControl,UserControl,-1,DblClick Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object." Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyDown Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus." Event KeyPress(KeyAscii As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyPress Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key." Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus." Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDown Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus." Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMove Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse." Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUp Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus." Event WriteProperties(PropBag As PropertyBag) 'MappingInfo=UserControl,UserControl,-1,WriteProperties Attribute WriteProperties.VB_Description = "Occurs when a user control or user document is asked to write its data to a file." Event ReadProperties(PropBag As PropertyBag) 'MappingInfo=UserControl,UserControl,-1,ReadProperties Attribute ReadProperties.VB_Description = "Occurs when a user control or user document is asked to read its data from a file." 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,BackColor Public Property Get BackColor() As OLE_COLOR Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object." BackColor = UserControl.BackColor End Property Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR) UserControl.BackColor() = New_BackColor PropertyChanged "BackColor" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,ForeColor Public Property Get ForeColor() As OLE_COLOR Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object." ForeColor = UserControl.ForeColor End Property Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR) UserControl.ForeColor() = New_ForeColor PropertyChanged "ForeColor" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,Enabled Public Property Get Enabled() As Boolean Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events." Enabled = UserControl.Enabled End Property Public Property Let Enabled(ByVal New_Enabled As Boolean) UserControl.Enabled() = New_Enabled PropertyChanged "Enabled" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,Font Public Property Get Font() As Font Attribute Font.VB_Description = "Returns a Font object." Attribute Font.VB_UserMemId = -512 Set Font = UserControl.Font End Property Public Property Set Font(ByVal New_Font As Font) Set UserControl.Font = New_Font PropertyChanged "Font" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,BackStyle Public Property Get BackStyle() As Integer Attribute BackStyle.VB_Description = "Indicates whether a Label or the background of a Shape is transparent or opaque." BackStyle = UserControl.BackStyle End Property Public Property Let BackStyle(ByVal New_BackStyle As Integer) UserControl.BackStyle() = New_BackStyle PropertyChanged "BackStyle" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,BorderStyle Public Property Get BorderStyle() As Integer Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object." BorderStyle = UserControl.BorderStyle End Property Public Property Let BorderStyle(ByVal New_BorderStyle As Integer) UserControl.BorderStyle() = New_BorderStyle PropertyChanged "BorderStyle" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=UserControl,UserControl,-1,Refresh Public Sub refresh() Attribute refresh.VB_Description = "Forces a complete repaint of a object." UserControl.refresh End Sub Private Sub UserControl_Click() RaiseEvent Click End Sub Private Sub UserControl_DblClick() RaiseEvent DblClick End Sub Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer) RaiseEvent KeyDown(KeyCode, Shift) End Sub Private Sub UserControl_KeyPress(KeyAscii As Integer) RaiseEvent KeyPress(KeyAscii) End Sub Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer) RaiseEvent KeyUp(KeyCode, Shift) End Sub Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) RaiseEvent MouseDown(Button, Shift, X, Y) End Sub Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) RaiseEvent MouseMove(Button, Shift, X, Y) End Sub Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) RaiseEvent MouseUp(Button, Shift, X, Y) End Sub Private Sub UserControl_Resize() Dim a As Integer If UserControl.Width < UserControl.Height Then a = UserControl.Width Else a = UserControl.Height End If Picture1.Width = UserControl.Width Picture1.Height = UserControl.Height UserControl.refresh End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) RaiseEvent WriteProperties(PropBag) Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H8000000F) Call PropBag.WriteProperty("ForeColor", UserControl.ForeColor, &H80000012) Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True) Call PropBag.WriteProperty("Font", UserControl.Font, Ambient.Font) Call PropBag.WriteProperty("BackStyle", UserControl.BackStyle, 1) Call PropBag.WriteProperty("BorderStyle", UserControl.BorderStyle, 0) Call PropBag.WriteProperty("max", m_max, m_def_max) Call PropBag.WriteProperty("min", m_min, m_def_min) Call PropBag.WriteProperty("value", m_value, m_def_value) Call PropBag.WriteProperty("Scrolling", m_scroll, m_def_Scroll) End Sub Private Sub UserControl_ReadProperties(PropBag As PropertyBag) RaiseEvent ReadProperties(PropBag) UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F) UserControl.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012) UserControl.Enabled = PropBag.ReadProperty("Enabled", True) Set UserControl.Font = PropBag.ReadProperty("Font", Ambient.Font) UserControl.BackStyle = PropBag.ReadProperty("BackStyle", 1) UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 0) m_max = PropBag.ReadProperty("max", m_def_max) m_min = PropBag.ReadProperty("min", m_def_min) m_value = PropBag.ReadProperty("value", m_def_value) m_scroll = PropBag.ReadProperty("Scrolling", m_def_Scroll) End Sub 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MemberInfo=7,0,0,0 Public Property Get max() As Integer Attribute max.VB_Description = "Returns/Sets a Control's Maximum Value" max = m_max End Property Public Property Let max(ByVal New_max As Integer) m_max = New_max PropertyChanged "max" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MemberInfo=7,0,0,0 Public Property Get min() As Integer Attribute min.VB_Description = "Returns/Sets a Control's Minimum Value" min = m_min End Property Public Property Let min(ByVal New_min As Integer) m_min = New_min PropertyChanged "min" End Property Public Property Get Scrolling() As scrollingconstant Scrolling = m_scroll End Property Public Property Let Scrolling(ByVal New_scr As scrollingconstant) m_scroll = New_scr PropertyChanged "Scrolling" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MemberInfo=7,2,2,0 Public Property Get value() As Integer Attribute value.VB_MemberFlags = "400" If Ambient.UserMode Then Err.Raise 393 value = m_value End Property Public Property Let value(ByVal New_value As Integer) If Ambient.UserMode = False Then Err.Raise 387 m_value = New_value PropertyChanged "value" draw End Property 'Initialize Properties for User Control Private Sub UserControl_InitProperties() Set UserControl.Font = Ambient.Font m_max = m_def_max m_min = m_def_min m_value = m_def_value End Sub Sub draw() Dim i As Integer, j As Integer Dim ang As Single, angle As Single Picture1.Cls Dim inc As Integer Dim r As Integer Dim w As Integer, h As Integer w = Picture1.Width \ 2 h = Picture1.Height \ 2 If w >= h Then r = h Else r = w End If Dim X As Integer, Y As Integer inc = 360 / (m_max - m_min) ang = m_value * inc Picture1.DrawWidth = 2 For i = 0 To ang Step 20 For j = 0 To 8 + 15 * m_scroll angle = (i + j) * 3.14 / 180 X = r * Cos(angle) + w Y = h - r * Sin(angle) Picture1.Line (w, h)-(X, Y), RGB(0, 0, 128) Next Next End Sub
Write, Run & Share VB.net code online using OneCompiler's VB.net online compiler for free. It's one of the robust, feature-rich online compilers for VB.net language, running on the latest version 16. Getting started with the OneCompiler's VB.net compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as VB.net
. OneCompiler also has reference programs, where you can look for the sample code to get started with.
OneCompiler's VB.net online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample VB.net program which takes name as input and prints hello message with your name.
Public Module Program
Public Sub Main(args() As string)
Dim name as String = Console.ReadLine() ' Reading input from STDIN
Console.WriteLine("Hello " & name) ' Writing output to STDOUT
End Sub
End Module
Visual Basic is a event driven programming language by Microsoft, first released in the year 1991.
Variable is a name given to the storage area in order to identify them in our programs.
Simple syntax of Variable declaration is as follows
Dim variableName [ As [ New ] dataType ] [ = initializer ]
variableName = value
If condition-expression Then
'code
End If
If(conditional-expression)Then
'code if the conditional-expression is true
Else
'code if the conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
Else If(conditional-expression) Then
'code if the above conditional-expression is true
Else
'code if the above conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
If(conditional-expression)Then
'code if the above conditional-expression is true
End If
End If
Select [ Case ] expression
[ Case expressionlist
'code ]
[ Case Else
'code ]
End Select
For counter [ As datatype ] = begin To end [ Step step ]
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ counter ]
For Each element [ As datatype ] In group
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ element ]
While conditional-expression
'Code
[ Continue While ]
'Code
[ Exit While ]
'Code
End While
Do { While | Until } conditional-expression
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop
Do
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop { While | Until } conditional-expression
Procedure is a sub-routine which contains set of statements. Usually Procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
Procedures are of two types.
Functions return a value when they are called.
[accessModifiers] Function functionName [(parameterList)] As returnType
'code
End Function
Sub-procedures are similar to functions but they don't return any value.
Sub ProcedureName (parameterList)
'Code
End Sub