Click here to Skip to main content
11,934,389 members (31,496 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB
Dear all
I have developed a program which runs absolutely fine.
Now i want to be able to change the form's image at run time but that should remain as default (permanently)even after closing the program.
I did try using common dialog to set form's image but as soon as i close the program the image is gone.
Please help me
Thank you in advance.

I am using the following code

common dialog1.ShowOpen
Form1.Picture = LoadPicture(common dialog1.FileName)

thank you
Posted 10-Nov-12 23:30pm
sarfarazbhat 12-Nov-12 4:03am
Hello Sir
I have a problem in Data report in vb6 with access 2007. Actually I want to calculate the sum of rate field of selected records and show the sum on label in section 5 of the data report.
I did try but no success. I am using the following code.
Collapse | Copy Code
rs.Open "select * from patients where Receipt_date=#" & Label3.Caption & "#and investigation= '" & Combo1.Text & "'", Con, adOpenDynamic, adLockPessimistic

' DataReport1.Show

DataReport1.Sections(5).Controls("label17").Caption = ("select sum(rate) from patientswhere Receipt_date=#" & Label3.Caption & "#and investigation= '" & Combo1.Text & "'" & "")
Set DataReport1.DataSource = rs

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you want to make a change permanent, without altering the source code each time the image changes, then you need to store the image path in a file outside the application, and restore it when you load the program.

There are a huge number of ways you can do this, fvrom registry, to INI files, to databases, to date files, but this might be a simple way for you to do it:[^]

The only thing I would suggest is not to do what the author suggests as regards where to store the data: he stores it in the Application directory, which is not a good idea as on Vista and above there is a very good chance you won't have write access to that folder when you install your program properly. There is an Tip here that explains better places: Where should I store my data?[^]
sarfarazbhat 12-Nov-12 4:01am
Thank you very much sir.
OriginalGriff 12-Nov-12 4:12am
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 11 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100