dim x as integer
dim myday as string
myday = format$(now,"mm")

for x = 0 to 11
    image(x).picture = image(index).picture
  next
if myday = myday then image1(index).picture= app.path & "\*.jpg"
' that's okej

Now is the question
when I have in app.path 12 pictures
numbered from 01 to 12
How can I get the picture for the month
that myday is corresponding to.

Say myday = july then picture should be
the picture 07.jpg and next month
shold it be picture 08.jpg and so on

Recommended Answers

All 3 Replies

I believe that all you need to do is load the picture you want:

Image1(0).Picture = LoadPicture(MyPath & "\" & format(now,"mm") & ".jpg")

You probably know that App.Path doesn't work for design time. I usually set a string (MyPath) to the path that will be used while in design time, and change to app path when I Make the exe in the app path location.

first off , a few things from LeNenne
if you wanna show picture for the related month then why are you using loop to do that (No need to have loop here).

one more thing

if myday = myday

it will always be true.so why are you using if statement for such a conditin which always results in true.

now lets come to the topic
try this

Image1(0).Picture = LoadPicture(App.Path & "\" & Format(Now, "mm") & ".jpg")

here make sure the all 12 pictures are in .jpg format.And Image1 is set as control array.

hope this helps you . . .

My Bad!
I started to load all 12 pictures (another way if needed) and realized that would not be necessary, then didn't remove the index.
My apologies for misleading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.