I hope this is not a silly question but I'm trying to create a simple form which has 2 numeric updowns with a button I take the values and store them in a dictionary as two strings. Now I think this goes fine but I want to show the values after pressing the button also in separated textboxes.
namespace TestWayPointEditor
{
public struct Coordinate
{
public string Latitude { get; set; }
public string Longitude { get; set; }
public Coordinate(string latitude, string longitude)
{
this.Latitude = latitude;
this.Longitude = longitude;
}
}
public partial class Form1 : Form
{
HashSet<Coordinate> WayPoints = new HashSet<Coordinate>();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnAdd_Click(object sender, EventArgs e)
{
//Set lat and lon values in a string
string Lat = LatUpDown.Value.ToString();
string Lon = LongUpDown.Value.ToString();
WayPoints.Add(new Coordinate(Lat, Lon));
}
}
}
My form looks like this to give an idea of what I am doing
So if I have a latitude and longitude and press add it should appear in the textboxes and save it on the background. If I change the values and press add the second row should be filled and this should go on and on. Besides of that I want when I close this form (it is a second form of project) and open it again I did not loose my values.
I gues I have to make a class for this and it should be public. But I actually dont know where to start. I hope someone could guide.