locked
How convert entries in string or int ? RRS feed

  • Question

  • User395338 posted

    Hello,

    I would like to store two entries (a name and a price) generated from my cs in two lists: -A string list -An int list

    But, of course, I have this one mistake: Unable to convert 'Xamarin.Forms.Entry' to 'string'. And the same with the int

    I'd like to reuse these lists anywhere in my cs.

    Thanks to whoever will help me, thanks in advance!

    public partial class DetailPage : ContentPage { StackLayout parent; List Acheteur = new List(); List Prix = new List();

        public DetailPage()
        {
            InitializeComponent();
        }
    
        int incrementation = 0;
    
        Entry a;
        Entry b;
    
        public void Addbutton(object sender, EventArgs e)
        {
    
            incrementation++;
    
            a = new Entry { Placeholder = "Acheteur " + incrementation + " :" };
            b = new Entry { Placeholder = "Prix" };
    
            parent = layout;
    
            StackLayout child_stackLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = 
                LayoutOptions.FillAndExpand,
                Margin = new Thickness(20),
                Padding = 20,
                BackgroundColor = Color.Accent
            };
    
            // Ajouter mes objets au stacklayout
            child_stackLayout.Children.Add(a);
            child_stackLayout.Children.Add(b);
    
            //Ajoute le stacklayout au parent StackLayout
            parent.Children.Add(child_stackLayout);
        }
    }
    
    Sunday, June 28, 2020 8:04 PM

All replies

  • User371688 posted

    Hi @Nesilan, according to your code ,I couldn't reproduce the error you posted.

    The result is:

    Hi @Nesilan,could you please post a basic demo so that we can try to reproduce this question on our side?

    Besides, what features do you want to implement?We'd be happy to help you. :)

    Monday, June 29, 2020 3:31 AM