Click here to Skip to main content
15,913,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: not allregistry values being returned Pin
André Kraak10-Oct-11 22:40
André Kraak10-Oct-11 22:40 
GeneralRe: not allregistry values being returned Pin
JimmyRopes11-Oct-11 0:43
professionalJimmyRopes11-Oct-11 0:43 
Questionwaspmote c# programming (reading temperature and accelerometer) Pin
tusyukomi9-Oct-11 17:06
tusyukomi9-Oct-11 17:06 
AnswerRe: waspmote c# programming (reading temperature and accelerometer) Pin
Dave Kreskowiak9-Oct-11 17:20
mveDave Kreskowiak9-Oct-11 17:20 
AnswerRe: waspmote c# programming (reading temperature and accelerometer) Pin
BobJanova10-Oct-11 3:44
BobJanova10-Oct-11 3:44 
Questiondatetime scheduled events help please Pin
CCodeNewbie9-Oct-11 10:40
CCodeNewbie9-Oct-11 10:40 
AnswerRe: datetime scheduled events help please Pin
Pete O'Hanlon9-Oct-11 10:53
mvePete O'Hanlon9-Oct-11 10:53 
AnswerRe: datetime scheduled events help please Pin
Luc Pattyn9-Oct-11 12:11
sitebuilderLuc Pattyn9-Oct-11 12:11 
AnswerRe: datetime scheduled events help please Pin
PIEBALDconsult9-Oct-11 14:03
mvePIEBALDconsult9-Oct-11 14:03 
QuestionSelecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:16
teknolog1239-Oct-11 4:16 
SuggestionRe: Selecting multiple controls by mouse Pin
André Kraak9-Oct-11 4:19
André Kraak9-Oct-11 4:19 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:26
teknolog1239-Oct-11 4:26 
GeneralRe: Selecting multiple controls by mouse Pin
André Kraak9-Oct-11 4:45
André Kraak9-Oct-11 4:45 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:51
teknolog1239-Oct-11 4:51 
AnswerRe: Selecting multiple controls by mouse Pin
BillWoodruff9-Oct-11 12:03
professionalBillWoodruff9-Oct-11 12:03 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog12311-Oct-11 0:16
teknolog12311-Oct-11 0:16 
GeneralRe: Selecting multiple controls by mouse Pin
BillWoodruff11-Oct-11 16:35
professionalBillWoodruff11-Oct-11 16:35 
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;
        }
    }
}

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.