1 Replies - 173 Views - Last Post: 09 June 2019 - 06:02 AM Rate Topic: -----

#1 Realme   User is offline

  • D.I.C Head

Reputation: -9
  • View blog
  • Posts: 147
  • Joined: 22-May 19

Windows form application

Posted 09 June 2019 - 05:51 AM

Hi,

I have made a simple windows form application and in this I have 2 simple things.

1. Button
2. Textbox

Textbox = small display

When I press the button, name from a list is supposed to appear in the textbox. But no text is shown only half way is shown as following: "System.Collections.Generic.List`1[System.String]"

Here is the code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    
    public partial class Form1 : Form
    {
        List<string> Spara = new List<string>();
        
        public static Random rng;
        public static int siffra;

        public Form1()
        {
          
            InitializeComponent();
            siffra = 1;
            Spara.Add("2222");
            
            
            textBox1.Text = Convert.ToString(siffra);
            rng = new Random();

            
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            siffra = rng.Next(1, 7);
            textBox1.Text = Convert.ToString(siffra);
            textBox1.Text = Convert.ToString(Spara);
        }

        private void SökRuta(object sender, EventArgs e)
        {
            
        }
    }
}



As I said, very simple code, and this is my first time I am working on windows form application so excuse me if something is obvious but I don't see.

what do I need to do to generate the number "2222" on the screen from the list?

This post has been edited by Realme: 09 June 2019 - 05:51 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Windows form application

#2 Realme   User is offline

  • D.I.C Head

Reputation: -9
  • View blog
  • Posts: 147
  • Joined: 22-May 19

Re: Windows form application

Posted 09 June 2019 - 06:02 AM

Sorry guys... I found out, stupid same mistake...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1