C # Best overloaded method matching for ... has some invalid arguments

public class RegistrationClass
{
     SqlConnection myConnection = new SqlConnection("Data Source=MOE-PC\\SQLEXPRESS;Initial Catalog=db_University;Integrated Security=True;Pooling=False");
    ConnectionClass con = new ConnectionClass();
    int ID , i;
    String fullName, motherName, gender, placeOfBirth, email, phone, adress, schoolDegree, languages, highSchool, faculty, major;



    public void setValues (String fullName1,String motherName1,String gender1,String placeOfBirth1,String email1,String phone1,String adress1, String faculty1,String major1,String schoolDegree1,String languages1,String highSchool1)
    {

        fullName = fullName1;
        motherName = motherName1;
        gender = gender1;
        placeOfBirth= placeOfBirth1;
        email =email1;
        phone= phone1;
        adress =adress1;
        faculty =faculty1;
        major =major1;
        schoolDegree =schoolDegree1;
        languages =languages1;
        highSchool = highSchool1;
    }

this is a web form button on a button with a button

public partial class WebForm1 : System.Web.UI.Page
{


    protected void Button_Register_Click(object sender, EventArgs e)
    {
        string lang = "";
        Classes.RegistrationClass R = new Classes.RegistrationClass();
        R.setValues(txt_Name.ToString, txt_MotherName.ToString, dropDown_Gender.ToString, dropDown_POB.ToString, txt_Email.ToString, txt_Phone.ToString, txt_Adress.ToString, DropDown_Faculty.ToString, DropDown_Major.ToString, dropDown_SchoolDegree.ToString, txt_Name.ToString, txt_HighSchool.ToString);

. ,,.

Here is the error:

The best overloaded method match for 'CCharpApp.RegistrationClass.setValues ​​(string, string, string, string, string, string, string, string, string, string, string, string, string)' has some invalid arguments.

Please help me guyz.

+4
source share
1 answer

txt_Name.ToString , ToString. ToString. txt_Name.ToString(). , . ToString TextBox . Text , , : txt_Name.Text.

, . , , , , ; , . RegistrationClass , . .

+11

Source: https://habr.com/ru/post/1531049/


All Articles