Error 1 Type’Secret.AddPage’ already defines a member called
‘AddPage’ with the same parameter typesError 2 Type’Secret.AddPage’ already defines a member called
‘PhoneApplicationPage_Loaded’ with the same parameter types
This is what I have so far The code written, any help is greatly appreciated.
enter code here
using System;
using System.Collections.Generic;< br />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 Microsoft .Phone.Controls;
using System.Device.Location;
namespace secret
{
public partial class AddPage: PhoneApplicationPage
{
private string location = "";
public AddPage()
{
InitializeComponent();
GeoCoordinateWatcher myWatcher = new GeoCoordinateWatcher();
var myPosition = myWatcher.Position;
// Eftersom koden körs i emulatorn kan den inte få tillgång till riktiga GPS-värden
// Därför hårdkodas koordinaterna till slottet i Gamtla så at SR MAPS Web Services
//kan testas.
double latitude = 40.717;
double longitude = -74;
if (!myPosition.Location. IsUnknown)
{
latitude = myPosition.Location.Latitude;
longitude = myPosition.Location.Longitude;
}
myTerraService.TerraServiceSoapClient client = new myTerraService.TerraServiceSoapClient();
client.ConvertLonLatPtToNearestPlaceCompleted += new EventHandler(client_ConvertLonLatPtToNearestPlaceCompleted);
client.ConvertLonLatPtToNearestPlaceAsync(new myTerraService.LonLatPt {Lat = latitude, Lon = longitude object });
}
PToearNearestPlaceCompleted sender, myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs e)
{
location = e.Result;
//throw new NotImplementedException();
}
private void AppBar_Cancel_Click(object sender, EventArgs e)
{
navigateBack();
}
private void AppBar_Save_Click(object sender, EventArgs e) )
{// spara en ny anteckning
if (location.Trim().Length == 0)
{
location = "Okänd";
}
navigateBack();
}
private void navigateBack()
{
NavigationService.Navigate(new Uri(" /secret;component/NotesMainPage. xaml", UriKind.Relative));
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
editTextBox.Focus();
}
}
}
You can check the solution explorer, find the source file and delete it from it, or You can delete these members from the current partial class.
You may see: Partial Classes and Methods (C# Programming Guide)
To search for other classes that contain partial classes Source file, please right-click Class Name AddPage and select Go to Definition. You will see multiple results in the “Find Symbols” result window in visual studio.
I’m having a problem in Visual Studio, it keeps saying that I have defined a member with the same parameter type. I am new to C# programming and I really don’t know how to do it. These are the errors that are happening:
Error 1 Type’Secret.AddPage’ already defines a member called
‘AddPage’ with the same parameter typesError 2 Type’Secret.AddPage’ already defines a member called
‘PhoneApplicationPage_Loaded’ with the same parameter types
This is the code I have written so far, any help is greatly appreciated.
enter code here
using Sy stem;
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 Microsoft.Phone.Controls;
using System.Device.Location;
namespace secret
{
public partial class AddPage: PhoneApplicationPage
{
private string location = "";
public AddPage()
{
InitializeComponent();
GeoCoordinateWatcher myWatcher = new GeoCoordinateWatcher();
var myPosition = myWatcher.Position;
// Eftersom koden körs i emulatorn kan den inte få tillgång till riktiga GPS-värden
// Därför hårdkodas koordinaterna till slottet i Gamla stan så att MSR MAPS Web Services
//kan testas.
double latitude = 40.717;
double longitude = -74;
if (!myPosition.Location.IsUnknown)
{
latitude = myPosition.Location.Latitude;< br /> longitude = myPosition.Location.Longitude;
}
myTerraService.TerraServiceSoapClient client = new myTerraService.TerraServiceSoapClient();
client.ConvertLonLatPtToNearestPlaceCompleted += new EventHandler(client_ConvertLonLatPtToNearestPlaceCompleted);
client.ConvertLonLatPtToNearestPlaceAsync(new myTerraService.LonLatPt {Lat = longlatitude />, Lonitude = />, L />) void client_ConvertLonLatPtToNearestPlaceCompleted(object sender, myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs e)
{
location = e.Result;
//throw new NotImplementedException();
}
p rivate void AppBar_Cancel_Click(object sender, EventArgs e)
{
navigateBack();
}
private void AppBar_Save_Click(object sender, EventArgs e)
{// spara en ny anteckning
if (location.Trim().Length == 0)
{
location = "Okänd";
}
navigateBack();
}
private void navigateBack()
{
NavigationService.Navigate(new Uri("/secret;component/ NotesMainPage.xaml", UriKind.Relative));
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
editTextBox.Focus();< br />
}
}
}
You are creating a partial class, so you may be These members are defined in another source file of .
You can check the Solution Explorer, find the source file and delete it from it, or you can delete it from the current partial class These members.
You may see: Partial Classes and Methods (C# Programming Guide)
To search for other source files containing partial classes, right-click Class Name AddPage And select Go to Definition. You will be in the “Find Symbol” result window in visual studio See multiple results in .