A
Andrei Ciopas
Guest
Hello i'm having a problem converting to string in my project , I'm quite a beginner still learning c#.
Here is my code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace mortiimatii
{
[Activity(Label = "Fixture")]
public class Fixture : Activity
{
private List<string> mItems;
private ListView fixList;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
//Set View
SetContentView(Resource.Layout.Fixture);
//Set View
//ViewConnect
fixList = FindViewById<ListView>(Resource.Id.FixtureList);
var fixSearch = FindViewById<EditText>(Resource.Id.FixSearch);
//ViewConnect
// List
mItems = new List<Fixture_List>
{
mItems.Add( new Fixture_List { FixtureId = "3254" , FixtureName = "text1" , FixtureRaft ="3" , FixtureNumar = "20"})
};
MyListViewAdapter adapter = new MyListViewAdapter(this, mItems);
fixList.Adapter = adapter;
}
}
}
And here is my List :
namespace mortiimatii
{
class Fixture_List
{
public string FixtureId { get; set; }
public string FixtureName { get; set; }
public string FixtureRaft { get; set; }
public string FixtureNumar { get; set; }
}
}
The error i'm getting is cannot convert to string in this line :
mItems.Add( new Fixture_List { FixtureId = "3254" , FixtureName = "text1" , FixtureRaft ="3" , FixtureNumar = "20"})
The error i'm getting is :
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'mortiimatii.Fixture_List' to 'string' mortiimatii E:\Code Projects\M4App\mortiimatii\mortiimatii\Fixture.cs 35 Active
This is supposed to be an app in xamarin to display a list of products
Continue reading...
Here is my code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace mortiimatii
{
[Activity(Label = "Fixture")]
public class Fixture : Activity
{
private List<string> mItems;
private ListView fixList;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
//Set View
SetContentView(Resource.Layout.Fixture);
//Set View
//ViewConnect
fixList = FindViewById<ListView>(Resource.Id.FixtureList);
var fixSearch = FindViewById<EditText>(Resource.Id.FixSearch);
//ViewConnect
// List
mItems = new List<Fixture_List>
{
mItems.Add( new Fixture_List { FixtureId = "3254" , FixtureName = "text1" , FixtureRaft ="3" , FixtureNumar = "20"})
};
MyListViewAdapter adapter = new MyListViewAdapter(this, mItems);
fixList.Adapter = adapter;
}
}
}
And here is my List :
namespace mortiimatii
{
class Fixture_List
{
public string FixtureId { get; set; }
public string FixtureName { get; set; }
public string FixtureRaft { get; set; }
public string FixtureNumar { get; set; }
}
}
The error i'm getting is cannot convert to string in this line :
mItems.Add( new Fixture_List { FixtureId = "3254" , FixtureName = "text1" , FixtureRaft ="3" , FixtureNumar = "20"})
The error i'm getting is :
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'mortiimatii.Fixture_List' to 'string' mortiimatii E:\Code Projects\M4App\mortiimatii\mortiimatii\Fixture.cs 35 Active
This is supposed to be an app in xamarin to display a list of products
Continue reading...