Results 1 to 6 of 6

Thread: [2005]How can I get the name of the image in a PictureBox

Hybrid View

  1. #1
    Addicted Member
    Join Date
    Mar 2006
    Posts
    235

    Re: [2005]How can I get the name of the image in a PictureBox

    Since you are loading the image, just set the picturebox tag value to the fielname.

    VB Code:
    1. PictureBox.tag = "c:\test.jpg"
    2.  
    3. ImgName = PictureBox.tag

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005]How can I get the name of the image in a PictureBox

    Hi,

    I find a way, since I am loading the image into the PictureBox From a resource file:

    VB Code:
    1. #Region " Declarations "
    2.     'Begin Declare Image Array ******************************************
    3.     Private MyPicArray As System.Drawing.Image() = {My.Resources.Image01, _
    4.        My.Resources.Image02, My.Resources.Image03, My.Resources.Image04, My.Resources.Image05, _
    5.        My.Resources.Image06, My.Resources.Image07, My.Resources.Image08, My.Resources.Image09, _
    6.        My.Resources.Image10, My.Resources.Image11, My.Resources.Image12}
    7.     'End Declare Image Array ******************************************
    8.     Dim PicNum As Double
    9.     Dim PicName As String
    10. #End Region
    11.  
    12.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    13.         For PicNum = 0 To MyPicArray.Length - 1
    14.             PicName = Format(PicNum, "00") & ".jpg"
    15.             MyPicArray(PicNum).Tag = "Image" & PicName
    16.         Next
    17.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width