Click to See Complete Forum and Search --> : SilvererLight 4 Error


erummirza
10-04-2010, 01:55 AM
i m geeting silverligth error
Error 1 'int VotingPanel2.CreateSurveyForm.client_CheckSurveyExistCompleted(object, VotingPanel2.ServiceReference3.CheckSurveyExistCompletedEventArgs)' has the wrong return type C:\Users\Iram\Documents\Visual Studio 2008\Projects\VotingPanel2\VotingPanel2\CreateSurveyForm.xaml.cs 24 49 VotingPanel2

Error 2 No overload for method 'CheckSurveyExistAsync' takes '0' arguments C:\Users\Iram\Documents\Visual Studio 2008\Projects\VotingPanel2\VotingPanel2\CreateSurveyForm.xaml.cs 26 13 VotingPanel2

Error 3 'VotingPanel2.CreateSurveyForm.client_CheckSurveyExistCompleted(object, VotingPanel2.ServiceReference3.CheckSurveyExistCompletedEventArgs)': not all code paths return a value C:\Users\Iram\Documents\Visual Studio 2008\Projects\VotingPanel2\VotingPanel2\CreateSurveyForm.xaml.cs 33 14 VotingPanel2

Error 5 Cannot implicitly convert type 'void' to 'int' C:\Users\Iram\Documents\Visual Studio 2008\Projects\VotingPanel2\VotingPanel2\CreateSurveyForm.xaml.cs 44 17 VotingPanel2
here is piece of code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using VotingPanel2.ServiceReference3;

namespace VotingPanel2
{
public partial class CreateSurveyForm : Page
{
public CreateSurveyForm()
{
InitializeComponent();
VotingPanel2.ServiceReference3.Service3Client client = new VotingPanel2.ServiceReference3.Service3Client();

client.CheckSurveyExistCompleted += new EventHandler<VotingPanel2.ServiceReference3.CheckSurveyExistCompletedEventArgs>(client_CheckSurveyExistCompleted);

client.CheckSurveyExistAsync();
}

// Executes when the user navigates to this page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
int client_CheckSurveyExistCompleted(object sender, VotingPanel2.ServiceReference3.CheckSurveyExistCompletedEventArgs e)
{
}

private void Button_Click(object sender, RoutedEventArgs e)
{


Service3Client client = new Service3Client();
int a;
a = client.CheckSurveyExistAsync(this.Title.Text);


}


}
}


here is service code

public int CheckSurveyExist(string Title)
{






DataClasses2DataContext db2 = new DataClasses2DataContext();



DataClasses2DataContext db2 = new DataClasses2DataContext();

///IEnumerable<int> highScoresQuery3 =

int highScoreCount =
(from c in db2.Surveys
where c.SurveyTitle == Title select c).Count() ;
return highScoreCount;

}

erummirza
10-05-2010, 07:22 AM
i have an error

Error 3 The type or namespace name 'CheckSurveyExistCompletedEventArgs' does not exist in the namespace 'VotingPanel2.ServiceReference3' (are you missing an assembly reference?) C:\Users\Iram\Documents\Visual Studio 2008\Projects\VotingPanel2\VotingPanel2\CreateSurveyForm.xaml.cs 37 93 VotingPanel2


i changed some of my code

void client_CheckSurveyExistCompleted(object sender, VotingPanel2.ServiceReference3.CheckSurveyExistCompletedEventArgs e)
{
int a;
a = e.Result;
// if a

// MessageBox.Show(e.Result.ToString ());


}




public void CheckSurveyExist(string Title, string question, string option1, string option2, string option3)
{



DataClasses2DataContext db2 = new DataClasses2DataContext();



int highScoreCount =
(from c in db2.Surveys
where c.SurveyTitle == Title
select c).Count();

if (highScoreCount > 0)
{
return;

}
else
{
InsertSurveyData(Title, question, option1, option2, option3);
}


}