Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is this code is correct or have any mistake.Plz help....

in user control:

C++
private Point[] _pin1PointPath = new Point[4];      
private Point[] _pin2PointPath = new Point[4];      
public Point[] pin1PointPath       
{           
   get { return _pin1PointPath; }       
}       
public Point[] pin2PointPath       
{           
   get { return _pin2PointPath; }       
}



C++
public void setInput()       
{           
   if (temp_StaticVariable.staticVariable.ps_inputpinNo2 == 1)           
        {              
             /////....             
               _pin1PointPath = ps_Path;            
             ///...         
        }           
   else
        {   
           /////....          
          _pin2PointPath = ps_Path; 
           .....          
        }       
}



In main page:

C++
vAnd[i].setInput();
///....




actually these both variable behaving like a static variable...

I am not able to understand. i used brekpoint also. all vAnd have same value for only these variable.
Posted
Comments
himani_jha 17-Jun-10 6:41am    
actually when i m tring this without arry means declaring each varible then it works fine.. plz give solution to do it with array
Bigdeak 18-Jun-10 3:50am    
I wan't to help, but i really don't understand, what are you planning to do. Can you explain you question preciser?
himani_jha 18-Jun-10 4:01am    
u can see in that code that i have declaed an array in usercontrol right. then i used it in user control and main page.
These array are not static variable but when i assign a value to a particular array of a particular usercontrol it reflect same value in all array variable.....
when i use invidual 4 variable in spite of an array of 4 size its work fine means there is some problem in initializing of array........

1 solution

hi friend,

Just try with this,
private Point[] _pin1PointPath = new Point[4];      
private Point[] _pin2PointPath = new Point[4];      
public Point[] pin1PointPath       
{           
   get { return _pin1PointPath[number]; }       
}       
public Point[] pin2PointPath       
{           
   get { return _pin2PointPath[number]; }       
}

public void setInput()       
{           
   if (temp_StaticVariable.staticVariable.ps_inputpinNo2 == 1)           
        {              
             /////....             
               _pin1PointPath[number] = ps_Path;            
             ///...         
        }           
   else
        {   
           /////....          
          _pin2PointPath[number] = ps_Path; 
           .....          
        }       
}


Thanks,
Mahesh Patel
 
Share this answer
 
Comments
Henry Minute 18-Jun-10 9:03am    
Will that even compile? Where on earth does 'number' come from?

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