Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.

Similar presentations


Presentation on theme: "Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3."— Presentation transcript:

1 Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3

2 Continued from last week’s demo Difference between label and text boxes Properties window –Changing name and text –Border Style –AutoSize –BackColor –Font Size –Visible –TabIndex

3 Solution Explorer Show all files

4 Visual Basic Controls Choose Windows forms application What you see is the IDE (Integrated Development Environment) Use Sizing handle to make the form Adjust the size of the properties window Tac the toolbox –Use common controls Start placing objects on the form Place a button, label it Exit and add code me.close()

5 Applications Console –Output appears in console window –From Visual studio choose VB and choose a new project, and choose Console Application, Give it a name. –Follow Chapter 3. Window

6 Demo of Hello program Dim name As String Console.Write("Please Enter your Name > ") name = Console.ReadLine() Console.Write("Hello " & name & "!") Console.ReadLine()

7 Adding a pop-up message box Add a form to the application Add this line MessageBox.Show("Hello " & name & "!", "Show Message")

8 Discuss Assignment that was turned in Explain input –Public Class FrmBreak1 – Dim num As Integer – Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReadNum.Click – num = InputBox("Enter a Number", "Read Number") – lblNumber.Text = num – End Sub –End Class

9 Program submission Program print out Program Run Place them in a manila folder

10 Writing to sequential file – For Future Submissions Imports System.IO Public Class SeqFileWrite Dim fileName As String Dim fileWriter As StreamWriter Dim output As FileStream Private Sub btnFileSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFileSave.Click fileName = txtFileName.Text output = New FileStream(fileName, FileMode.Create, FileAccess.Write) fileWriter = New StreamWriter(output) fileWriter.WriteLine("Hello World") fileWriter.WriteLine("My Name is: John Abraham, Now this works.") fileWriter.Close() End Sub End Class


Download ppt "Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3."

Similar presentations


Ads by Google