Reading from File & Picture Boxes Dr. John Abraham Professor UTPA
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)
Demo Read Program Note that cards(0) is blank.
Picture boxes Back Color Choose a back color Or a Background Image for the form Create a pictureBox
Picture Box Choose the pictureBox for the toolBox Change the Name Add an Image (picture) from the the file As in the Example Program
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)
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.
Demo the program here.