What is a Computer? A computer is a logical device for processing information . Specifically, computers process data. Data = structured information Base: Silicon VLSI technology VLSI = Very Large-Scale Integrated circuits Computers are Powerful! Can perform logical computations much faster than Humans. Current speed (desktop!): 4 x109 basic operations/sec (GHz) Each a simple logical operation (division, shift, write, etc.)
What is a Computer? Computers are Limited… Computation basically sequential… One operation at a time. In contrast, Humans use parallel processing ( by neurons). We are better at complex tasks (e.g., Vision, Pattern Recognition) Computers not very ‘adaptive’… Standard computers mainly do what they are told. Communication difficult (computers think logically): Programming languages (and programmers) required!
Software vs. Hardware At the most basic level computers can be broken down into two components: Hardware and Software Hardware = the physical components of the computer system. Data Processing: The Central Processing Unit (CPU) Data Storage : Memory storage devices: RAM (primary), Hard drive (secondary), flash disks (peripheral), etc. Data Communication : Devices for Input/Output: Input: Keyboard, mouse, etc. Output: Display, printer, speaker
Software vs. Hardware Software = the computer programs that run on a computer These establish logical control over the hardware: Manage the details of Data Processing, Storage, and Communication. The Operating System (OS): primary system control Windows, Ubuntu Linux, Mac OS X, Unix, etc. Application Software: MS-Word, PowerPoint, Excel, etc. User-built Applications: using a Programming Language
Programming Languages Many Programming Languages have been developed. Some well-known compiled High-Level Languages include (older to newer):
Programming Languages Many others, including interpreted languages: Python, Perl, Ruby, etc. Languages allow communication between humans and computers… This involves converting abstract algorithms for solving problems into a form understandable by the computer. An ‘executable’ (i.e., run-able) form. Such a converted algorithm is called a program . The people that do the conversion (at the high level) are us…the programmers .
Interpreted vs. Compiled Languages Before execution, instructions in a program must also be converted: from a text file (human-readable words in a HLL)… …to an executable form (first to assembly, then to machine language) Two flavors exist for this conversion process: In advance ( compiled all at once ): Conversion by a program called a ‘compiler’. Faster, but less adaptable …better for Engineering. ‘On the fly’ (interpreted one instruction at a time): Conversion by a program called an ‘interpreter’. Slower, but programs may be changed at run-time …better for real-time Analysis and Management.
Interpreted vs. Compiled Languages Programming languages may be of either type... Interpreted: Python, Perl, bash scripting (Linux), JavaScript Compiled: C, C++, C#, and VB .NET (visual basic) Some (JAVA, VB .NET, C#) are essentially a combination of both:
Visual Basic vs. VB .NET BASIC B eginner’s A ll-purpose S ymbolic I nstruction C ode Developed as an extension of C, to be a general-purpose programming language. Visual BASIC (VB) BASIC + a Graphical User Interface (GUI) Greatly eases the creation of Windows applications Especially, by facilitating the use of re-usable components
Visual Basic vs. VB .NET Visual BASIC .NET A programming language based on VB 6.0 Working on the .NET framework of the Microsoft Corporation A Platform for cross-language development (C#, VB. NET, C++, F#) Includes a large standard library called the BCL (Base Class Library)
Visual Basic vs. VB .NET Visual Studio Microsoft’s Integrated Development Environment (IDE) for VB .NET. Intended mainly for Windows Applications and Web Applications. We will use Visual Studio 2010 to create all our programs.
VB .NET Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language , implemented on .NET, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0 . Microsoft updated its VB language strategy on 6 February 2023, stating that VB is a stable language now and Microsoft will keep maintaining it
Add a Slide Title - 3 Objects & Description 1 Forms The container for all the controls that make up the user interface. 2 TextBox It represents a Windows text box control. 3 Label It represents a standard Windows label. 4 Button It represents a Windows button control. 5 ListBox It represents a Windows control to display a list of items. Objects & Description 6 ComboBox It represents a Windows combo box control. 7 RadioButton It enables the user to select a single option from a group of choices when paired with other RadioButton controls. 8 CheckBox It represents a Windows CheckBox . 9 PictureBox It represents a Windows picture box control for displaying an image. 10 ProgressBar It represents a Windows progress bar control.
Add a Slide Title - 3 Objects & Description 11 ScrollBar It Implements the basic functionality of a scroll bar control. 12 DateTimePicker It represents a Windows control that allows the user to select a date and a time and to display the date and time with a specified format. 13 TreeView It displays a hierarchical collection of labeled items, each represented by a TreeNode . 14 ListView It represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views. 11 ScrollBar It Implements the basic functionality of a scroll bar control.
Object Properties A PROPERTY is a value or characteristic held by a Visual Basic object, such as Caption or Fore Color. Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Object.
Object Events An EVENT is a signal that informs an application that something important has occurred. For example, when a user clicks a control on a form, the form can raise a Click event and call a procedure that handles the event. Events also allow separate tasks to communicate.
Form Properties Once the Form is added to the form, we can set various properties of the Form by clicking on the Form control .
Form Properties No . Property & Description 1 Name Sets the name of the Form. 2 Text Sets the Title of the Form in the title bar. 3 Font Gets or sets the font of the text displayed by the Form. 4 ForeColor Gets or sets the foreground color of the Form. 5 BackColor Sets the back color of the textbox 6 StartPosition Sets the location of the form during runtime. 7 Cursor Change the cursor once focused on the Form. 8 Enabled Make the Form enabled or disabled 9 MinimizedBox You can Hide or show the Minimize Button of the form. 10 MaximizedBox You can Hide or show the Maximize Button of the form.
Form Properties Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Example
Form commonly used events Event & Description Load Occurs when the Form is Running. FormClosed Occurs when the Form is closed . Resize Occurs when the Form is resized .
TextBox Properties Once the TextBox is added to the form, we can set various properties of the TextBox by clicking on the TextBox control.
TextBox Properties No . Property & Description 1 Name Sets the name of the Textbox. 2 Text Sets the text of the TextBox 3 Font Gets or sets the font of the text displayed by the control. 4 ForeColor Gets or sets the foreground color of the control. 5 Multiline Gets or sets a value indicating whether this is a multiline TextBox control. 6 BackColor Sets the back color of the textbox 7 Cursor Change the cursor once focused on the textbox. 8 Enabled Make the textbox enabled or disabled 9 PasswordChar Gets or sets the character used to mask characters of a password in a single-line TextBox control. 10 CharacterCasing Gets or sets whether the TextBox control modifies the case of characters as they are typed.
TextBox Properties Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Example
TextBox commonly used events Event & Description Click Occurs when the control is clicked. DoubleClick Occurs when the control is double-clicked. TextChanged Occurs when the TextAlign property value changes.
TextBox commonly used events Event & Description Click Occurs when the control is clicked. DoubleClick Occurs when the control is double-clicked. TextChange Occurs when the you type something in the TextBox .
Button Properties Once the Button is added to the form, we can set various properties of the Button by clicking on the Button control .
Button Properties No . Property & Description 1 Name Sets the name of the Button. 2 Text Sets the text of the Button 3 Font Gets or sets the font of the text displayed by the control. 4 ForeColor Gets or sets the foreground color of the control. 5 BackColor Sets the back color of the textbox 6 Image You can add an image of the Button 7 Cursor Change the cursor once focused on the textbox. 8 Enabled Make the textbox enabled or disabled 9 TextAlign Sets the alignment of the text inside the Button 10 Visible Sets the visibility of the Button
Button Properties Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Example
Button commonly used events Event & Description Click Occurs when the control is clicked. DoubleClick Occurs when the control is double-clicked.
RadioButton Once the RadioButton is added to the form, we can set various properties of the RadioButton by clicking on the RadioButton control .
RadioButton Properties No . Property & Description 1 Name Sets the name of the Button. 2 Text Sets the text of the Button 3 Font Gets or sets the font of the text displayed by the control. 4 ForeColor Gets or sets the foreground color of the control. 5 BackColor Sets the back color of the textbox 6 Image You can add an image of the Button 7 Cursor Change the cursor once focused on the textbox. 8 Enabled Make the textbox enabled or disabled 9 TextAlign Sets the alignment of the text inside the Button 10 Visible Sets the visibility of the Button
RadioButton Properties Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Example
RadioButton commonly used events Event & Description CheckedChanged Occurs when the control is clicked .
CheckBox Properties Once the CheckBox is added to the form, we can set various properties of the CheckBox by clicking on the CheckBox control . Note: You may explore the Checkbox Properties on your laboratories
CheckBox Properties Properties can be set at design time by using the Properties window or at run time by using statements in the program code. Example
Button commonly used events Event & Description ClickedChanged Occurs when the control is clicked .
VB Net Data Types Type Storage Allocation Value Range Boolean Depends on implementing platform True or False Byte 1 byte 0 through 255 (unsigned) Char 2 bytes 0 through 65535 (unsigned) Date 8 bytes 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999 Decimal 16 bytes 0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9...E+28) with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal
VB Net Data Types Type Storage Allocation Value Range Double 8 bytes -1.79769313486231570E+308 through -4.94065645841246544E-324, for negative values 4.94065645841246544E-324 through 1.79769313486231570E+308, for positive values Integer 4 bytes -2,147,483,648 through 2,147,483,647 (signed) Long 8 bytes -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807(signed) Object 4 bytes on 32-bit platform 8 bytes on 64-bit platform Any type can be stored in a variable of type Object SByte 1 byte -128 through 127 (signed)
VB Net Data Types Type Storage Allocation Value Range Short 2 bytes -32,768 through 32,767 (signed) Single 4 bytes -3.4028235E+38 through -1.401298E-45 for negative values; 1.401298E-45 through 3.4028235E+38 for positive values String Depends on implementing platform 0 to approximately 2 billion Unicode characters UInteger 4 bytes 0 through 4,294,967,295 (unsigned) ULong 8 bytes 0 through 18,446,744,073,709,551,615 (unsigned) UShort 2 bytes 0 through 65,535 (unsigned)
VB Net Data Types Category Type Example Integral types SByte , Byte, Short, UShort , Integer, UInteger , Long, ULong and Char Floating point types Single and Double Decimal types Decimal Boolean types True or False values, as assigned Date types Date
VB Net Variables A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in VB.Net has a specific type , which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.
Variable Initialization in VB.Net Variables are initialized (assigned a value) with an equal sign followed by a constant expression . The general form of initialization is variable_name = value
Variable Declaration in VB.Net The Dim statement is used for variable declaration and storage allocation for one or more variables. The Dim statement is used at module, class, structure, procedure or block level. Dim pi As Double pi = 3.14159
Variable Declaration in VB.Net You can initialize a variable at the time of declaration as follows Dim StudID As Integer = 100 Dim StudName As String = "Bill Smith"
Variable Declaration in VB.Net
VB.Net - Arithmetic Operators Following table shows all the arithmetic operators supported by VB.Net. Assume variable A =2 and variable B =7 , then Operator Description Example ^ Raises one operand to the power of another B^A will give 49 + Adds two operands A + B will give 9 - Subtracts second operand from the first A - B will give -5 * Multiplies both operands A * B will give 14 / Divides one operand by another and returns a floating point result B / A will give 3.5 \ Divides one operand by another and returns an integer result B \ A will give 3 MOD Modulus Operator and remainder of after an integer division B MOD A will give 1