VB 6.0 - Pass an Image to main Form - Asked By Mercedes Blanch on 03-Feb-12 02:01 AM

 I have Form2 with some images.  When user selects one (from the several options there are) and clicks a command the main form should open and the image previously selected on Form2 must be displayed on my main Form.  So far my main form opens but I do not know how to display/pass the image previously selected.  How can I do this? Please help!   
D Company replied to Mercedes Blanch on 03-Feb-12 02:05 AM
hello Friend.

on Main form, create object of Form2. and check the condition for selected image, suppose if you have taken a checkbox for this.

Form2 objform2=new Form2();

objform.urcheckbox and check for whether it checked or not.
else loop through all the check boxes on this form and fetch the appropritae one.

let me know if nee more help on this
Reena Jain replied to Mercedes Blanch on 03-Feb-12 02:17 AM

To pass the data from 1 form to another form you need to use static variable in class and then by class name you can access them any where in project for get or set the value. here is the sample code for this

in class at global side
public class myclass
public string usernm, password;

on login form


on other form where want to access

hope this will help you
Mercedes Blanch replied to Reena Jain on 03-Feb-12 02:23 AM
I could try what you say but not sure how to declare a public class in VB6.0 neither make global IMAGES as global variables :-(

Mercedes Blanch replied to D Company on 03-Feb-12 02:28 AM
Thank you for your help but I will need a deeper explanation.  Plus Im working on VB6.0 which Im afraid it does not support characters such as ";"...