Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
CreateCompanyProfile(txtcompanyname.Text, imgBinaryData, txtcompanytagline.Text, txtcompanyprof.Text, companyestd, companyempcount, txttype.Text, txttelephone.Text, txtemail.Text, txtfax.Text, txtaddress.Text,txturl.Text,txtmanagername.Text,txtmanagerdesign.Text,txtmanagerprofile.Text,  txtclients.Text, txthrname.Text, txthrdesign.Text, txthremail.Text);


i am calling this method as

C#
public void CreateCompanyProfile( string ComName, byte[] imgbin, string ComTagLine, string ComProfile, int ComEstd, int ComEmpCount, string ComType, string ComTelephone, string ComEmail, string ComFax, string ComAddress, string ComURL, string strmangername, string strmanagerdesign, string strmanagerprof, string ComClients, string CreaterName, string CreaterDesig, string CreaterMailID )

at this time iam getting 1 error :member names cannot be the same as their enclosing type c#
please help me ,what is the cause of this error?
Posted
Updated 7-Aug-12 20:03pm
v2
Comments
Santhosh Kumar Jayaraman 8-Aug-12 2:04am    
Whats your class name?
Prasad J 8-Aug-12 2:09am    
confirm that your variable [imgBinaryData] is a byte array.

The class name and the Method name might be same it seems..If so means change the name of your method...
 
Share this answer
 
I guess your method name is same as Class Name. Is that right?

If it is yes, then its wrong.Compiler assumes that method as constructor and since it has return type, it wil throw error
 
Share this answer
 
Comments
Mohamed Mitwalli 8-Aug-12 2:15am    
5+
Is CreateCompanyProfile name of your class? If yes then the code you wrote acts as a constructor. Constructor do not have return type. Change below block of code to following:
C#
public CreateCompanyProfile( string ComName, byte[] imgbin, string ComTagLine, string ComProfile, int ComEstd, int ComEmpCount, string ComType, string ComTelephone, string ComEmail, string ComFax, string ComAddress, string ComURL, string strmangername, string strmanagerdesign, string strmanagerprof, string ComClients, string CreaterName, string CreaterDesig, string CreaterMailID )


Else rename CreateCompanyProfile to CreateDetails or something like that.
 
Share this answer
 
Comments
Mohamed Mitwalli 8-Aug-12 2:15am    
5+
Please check value of address field parameter. it's a possibility that in any of your field there is ','. That's why your function treating as a new member.
OR

Check your class name and method name and also check the members name, Might the class name and one of the member of method CreateCompanyProfile is same.
Thanks
Ashish
 
Share this answer
 
v2

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