Click here to Skip to main content
15,891,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog12311-Oct-11 22:17
teknolog12311-Oct-11 22:17 
QuestionMEF Framework Pin
pravin_mun8-Oct-11 15:10
pravin_mun8-Oct-11 15:10 
AnswerRe: MEF Framework Pin
Abhinav S8-Oct-11 23:36
Abhinav S8-Oct-11 23:36 
AnswerRe: MEF Framework Pin
Luc Pattyn8-Oct-11 23:56
sitebuilderLuc Pattyn8-Oct-11 23:56 
AnswerRe: MEF Framework Pin
PIEBALDconsult9-Oct-11 3:55
mvePIEBALDconsult9-Oct-11 3:55 
QuestionUserdefinedControls Pin
pravin_mun8-Oct-11 15:07
pravin_mun8-Oct-11 15:07 
AnswerRe: UserdefinedControls Pin
OriginalGriff8-Oct-11 20:47
mveOriginalGriff8-Oct-11 20:47 
Questionbasic web service help Pin
SFORavi8-Oct-11 10:44
SFORavi8-Oct-11 10:44 
Hi

I am invoking a simple web service from Windows form to do simple addition.

The client code is as follows, defined array of int and setting values based on number pressed in the form.

Want to pass the array as parm to web service. Getting error that the method in web service does not have compatible arguments. Can you pls help to see find the issue is.

Client Code

C#
namespace Calculator
{
    public partial class Form1 : Form
    {
        private int sumSoFar;

        private int[] numcalc = new int[10];

        public Form1()
        {
            InitializeComponent();
            sumSoFar = 0;

            for (int i = 0; i < 10; i++)
            {
                numcalc[i] = 0;
            }

        }

        private void button0_Click(object sender, EventArgs e)
        {
            numcalc[0] = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            numcalc[1] = 1;
        }


        private void button2_Click(object sender, EventArgs e)
        {
            numcalc[2] = 2;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            numcalc[3] = 3;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            numcalc[4] = 4;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            numcalc[5] = 5;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            numcalc[6] = 6;
        }

        private void button7_Click(object sender, EventArgs e)
        {
            numcalc[7] = 7;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            numcalc[8] = 8;
        }

        private void button9_Click(object sender, EventArgs e)
        {
            numcalc[9] = 9;
        }



        private void button13_Click(object sender, EventArgs e)

       {
            MathOps.Service1SoapClient MathOpsObj  = new MathOps.Service1SoapClient() ;

            sumSoFar = MathOpsObj.AddValues(numcalc); 

<< err in this line, I thought numcalc is an array that can be passed as argument to web service, somehow getting error>>
        }


    }
}




Web service code

C#
namespace MathOps
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public int AddValues(int [] num)
        {
            int sumSoFar = 0;

            for (int i = 0; i < 10; i++)
            {
                sumSoFar = sumSoFar + num[i];
            }

            return sumSoFar;
        }
    }
}

AnswerRe: basic web service help Pin
André Kraak8-Oct-11 13:48
André Kraak8-Oct-11 13:48 
GeneralRe: basic web service help Pin
SFORavi12-Oct-11 21:03
SFORavi12-Oct-11 21:03 
QuestionMerge Modules for Crystal Report 2008 Pin
sathyan_82948-Oct-11 6:18
sathyan_82948-Oct-11 6:18 
AnswerRe: Merge Modules for Crystal Report 2008 Pin
Eddy Vluggen8-Oct-11 7:01
professionalEddy Vluggen8-Oct-11 7:01 
GeneralRe: Merge Modules for Crystal Report 2008 Pin
Luc Pattyn8-Oct-11 7:59
sitebuilderLuc Pattyn8-Oct-11 7:59 
GeneralRe: Merge Modules for Crystal Report 2008 Pin
Eddy Vluggen8-Oct-11 8:17
professionalEddy Vluggen8-Oct-11 8:17 
GeneralRe: Merge Modules for Crystal Report 2008 Pin
Luc Pattyn8-Oct-11 8:20
sitebuilderLuc Pattyn8-Oct-11 8:20 
Questionproblem with scrollbars auto positioning during dragging a panel Pin
Abhishrek8-Oct-11 5:22
Abhishrek8-Oct-11 5:22 
AnswerRe: problem with scrollbars auto positioning during dragging a panel Pin
Luc Pattyn8-Oct-11 5:44
sitebuilderLuc Pattyn8-Oct-11 5:44 
GeneralRe: problem with scrollbars auto positioning during dragging a panel Pin
Abhishrek8-Oct-11 6:17
Abhishrek8-Oct-11 6:17 
AnswerRe: problem with scrollbars auto positioning during dragging a panel Pin
Luc Pattyn8-Oct-11 7:57
sitebuilderLuc Pattyn8-Oct-11 7:57 
GeneralRe: problem with scrollbars auto positioning during dragging a panel Pin
Abhishrek8-Oct-11 16:37
Abhishrek8-Oct-11 16:37 
AnswerRe: problem with scrollbars auto positioning during dragging a panel Pin
Luc Pattyn8-Oct-11 16:45
sitebuilderLuc Pattyn8-Oct-11 16:45 
AnswerRe: problem with scrollbars auto positioning during dragging a panel Pin
Luc Pattyn9-Oct-11 13:30
sitebuilderLuc Pattyn9-Oct-11 13:30 
GeneralRe: problem with scrollbars auto positioning during dragging a panel Pin
Abhishrek9-Oct-11 15:18
Abhishrek9-Oct-11 15:18 
AnswerRe: problem with scrollbars auto positioning during dragging a panel Pin
Luc Pattyn9-Oct-11 16:49
sitebuilderLuc Pattyn9-Oct-11 16:49 
QuestionCaptcha Control Pin
Nolee K8-Oct-11 0:02
Nolee K8-Oct-11 0:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.