Download presentation
Presentation is loading. Please wait.
1
Reading from File & Picture Boxes
Dr. John Abraham Professor UTPA
2
Read Text File Imports System.io Private input As FileStream
Private fileReader As StreamReader input = New FileStream("carddeck.txt", FileMode.Open, FileAccess.Read) fileReader = New streamReader(input) Dim cards(0 To 52) As String inputData = fileReader.ReadLine() cards = inputData.Split(","c)
3
Demo Read Program Note that cards(0) is blank.
4
Picture boxes Back Color Choose a back color
Or a Background Image for the form Create a pictureBox
5
Picture Box Choose the pictureBox for the toolBox Change the Name
Add an Image (picture) from the the file As in the Example Program
6
Adding picture at Runtime
Dim PictureName As String Dim pictBox As PictureBox Dim offset As Integer = 5 PictureName = InputBox("What is the Name of the Picture?", "Picture") PictureName = "C:\vb2008\2008addPictures\" + PictureName pictBox = New PictureBox Controls.Add(pictBox) pictBox.BringToFront() pictBox.Image = Image.FromFile(PictureName)
7
Adding additional pictures
Need to move the offsets top and left pictBox.Top = offset pictBox.Width = 100 pictBox.Height = 100 pictBox.Left = offset offset = offset + 10 Repeat the steps from the prev slide.
8
Demo the program here.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.