c# - No overload for method '(Function Name)' takes '0' arguments -
while debugging got error : "no overload method 'studentcoursedetails_load' takes '0' arguments"
the studentcoursedetails winform , studentcoursedetails_load onload event form.i tried call event in function , got above said error.how can call event in function ? how can pass parameter's while calling event ?i don't know kind of parameter's sholud have pass. need help...
private void studentcoursedetails_load(object sender, eventargs e) { txtregno.enabled = false; txtstudentname.enabled = false; txtcoursid.enabled = false; txtcoursname.enabled = false; dtpdoj.enabled = false; txtfee.enabled = false; txtdiscountper.enabled = false; txtnarration.enabled = false; btnsave.text = "&add"; } private void btnadd_click(object sender, eventargs e) { switch (btnsave.text) { case "&add": txtregno.enabled = true; txtstudentname.enabled = true; txtcoursid.enabled = true; txtcoursname.enabled = true; dtpdoj.enabled = true; txtfee.enabled = true; txtdiscountper.enabled = true; txtnarration.enabled = true; btnsave.text = "&save"; break; case "&save": if (validation()) { if (messagebox.show("sure save?", cpublic.messagename, messageboxbuttons.yesno, messageboxicon.question) == dialogresult.yes) { selectstudentid(); cmd.connection = cpublic.comm_con; cmd.parameters.clear(); cmd.parameters.addwithvalue("@regno", txtregno.text); cmd.parameters.addwithvalue("@studentid", id); cmd.parameters.addwithvalue("@studentname", txtstudentname.text); cmd.parameters.addwithvalue("@courseid", txtcoursid.text); cmd.parameters.addwithvalue("@coursename", txtcoursname.text); cmd.parameters.addwithvalue("@doj", dtpdoj.value.tostring(cgeneral.servedatefmt)); cmd.parameters.addwithvalue("@fee", txtfee.text); cmd.parameters.addwithvalue("@discount", txtdiscountper.text); cmd.parameters.addwithvalue("@narration", txtnarration.text); cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "sp_insert_studentcoursedetails" + cpublic.g_firmcode; cmd.executenonquery(); messagebox.show("course added successfully...", cpublic.messagename, messageboxbuttons.ok, messageboxicon.information); clearall(); btnsave.enabled = true; btnsave.text = "&add"; studentcoursedetails_load(); } } break; } }
that because of line
btnsave.text = "&add"; studentcoursedetails_load();
you should rather use
studentcoursedetails_load(null, null);
obviously there can further error may face @ runtime.
Comments
Post a Comment