Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

VB
common dialog1.ShowOpen

Form1.Picture = LoadPicture(common dialog1.FileName)


thank you
Posted
Comments
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
DataReport1.Refresh
DataReport1.Show

1 solution

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: http://www.vb6.us/tutorials/store-data-resource-files-visual-basic-does[^]

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?[^]
 
Share this answer
 
Comments
sarfarazbhat 12-Nov-12 4:01am    
Thank you very much sir.
Sarfaraz
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900