1 / 8

Reading Text File & Managing Picture Boxes with Dr. John Abraham

Learn how to read text files and manage picture boxes with Dr. John Abraham, a professor at UTPA. This tutorial guides you through importing text files, creating picture boxes, adding images, and customizing their properties.

kathlynm
Download Presentation

Reading Text File & Managing Picture Boxes with Dr. John Abraham

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.

More Related