10 Replies - 718 Views - Last Post: 05 February 2012 - 10:52 AM Rate Topic: -----

Topic Sponsor:

#1 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Refresh main form background image

Posted 03 February 2012 - 02:40 AM

I would like to know how i can refresh my main form background image once a user picks a different image as the background.I have 2 forms namely Form1 (main form) and form2 from where the user can select the image he or she would like to set as the background image of form1.But the problem is that after selecting the image file from form2,when form1 is opened the background image doesnt change and remains the same as before.Only when the user ends the program and re-runs it again the image changes.

I tried

Form1.reload()



But it doesnt work.What am i doing wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: Refresh main form background image

#2 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: Refresh main form background image

Posted 03 February 2012 - 04:13 AM

try this
        Dim img As New Bitmap(strFilePath)
        Form1.BackgroundImage = img


Was This Post Helpful? 0
  • +
  • -

#3 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Refresh main form background image

Posted 03 February 2012 - 04:26 AM

View Postsela007, on 03 February 2012 - 04:13 AM, said:

try this
        Dim img As New Bitmap(strFilePath)
        Form1.BackgroundImage = img



doesn't work i tried...Isnt there anyway of refreshing form1? so as to refresh the old background into the new background selected in form2....by adding a timer maybe?
Was This Post Helpful? 0
  • +
  • -

#4 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: Refresh main form background image

Posted 03 February 2012 - 05:13 AM

i' am using vb2008 (3.5 net) and code works fine to me. Have try you some of these:
form1.show
form1.refresh
form1.activate



i can't find form1.reload in my vs.

This post has been edited by sela007: 03 February 2012 - 05:14 AM

Was This Post Helpful? 0
  • +
  • -

#5 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Refresh main form background image

Posted 03 February 2012 - 08:48 PM

View Postsela007, on 03 February 2012 - 05:13 AM, said:

i' am using vb2008 (3.5 net) and code works fine to me. Have try you some of these:
form1.show
form1.refresh
form1.activate



i can't find form1.reload in my vs.


No luck i still cant get the form to refresh itself.
Was This Post Helpful? 0
  • +
  • -

#6 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 960
  • View blog
  • Posts: 3,354
  • Joined: 25-September 09

Re: Refresh main form background image

Posted 04 February 2012 - 07:53 AM

Can you show us the code you're using?

I just did a simple test and as soon as I set the image in form2, form1's background image appeared so I guess the next step is to look at what you have and how you're trying to achieve this.
Was This Post Helpful? 0
  • +
  • -

#7 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Refresh main form background image

Posted 05 February 2012 - 07:21 AM

View PostCharlieMay, on 04 February 2012 - 07:53 AM, said:

Can you show us the code you're using?

I just did a simple test and as soon as I set the image in form2, form1's background image appeared so I guess the next step is to look at what you have and how you're trying to achieve this.


This is the code i used on form2 on the click event of a command button (to change the background)

Form1.Backgroundimage = My. resources.Waterfall
Form1. reload


Was This Post Helpful? 0
  • +
  • -

#8 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: Refresh main form background image

Posted 05 February 2012 - 07:45 AM

Where did you find 'reload' method? what net framework are you using?
Have you try with the same code in the some other project(without 'reload' method)?

This post has been edited by sela007: 05 February 2012 - 07:46 AM

Was This Post Helpful? 0
  • +
  • -

#9 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Refresh main form background image

Posted 05 February 2012 - 07:58 AM

View Postsela007, on 05 February 2012 - 07:45 AM, said:

Where did you find 'reload' method? what net framework are you using?
Have you try with the same code in the some other project(without 'reload' method)?


Im using Visual Basic 2010.I think its Net framework 4
Was This Post Helpful? 0
  • +
  • -

#10 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: Refresh main form background image

Posted 05 February 2012 - 08:15 AM

All I can say is to try with the same code in some other project. Or,download the sample project and try. download

This post has been edited by sela007: 05 February 2012 - 08:16 AM

Was This Post Helpful? 0
  • +
  • -

#11 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Refresh main form background image

Posted 05 February 2012 - 10:52 AM

View Postsela007, on 05 February 2012 - 08:15 AM, said:

All I can say is to try with the same code in some other project. Or,download the sample project and try. download


Thank You soo much it worked perfectly,I was going about this in a completely different way.
Thank You again for all the help appreciate it :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1