I am trying to import a file with a list of latitude and longitude coordinates. In Visual C#, and using GMAP.NET, a marker is placed for every coordinate pair. I want multiple files to be able to be uploaded, and for the user to be able to select the color of the marker for that specific file. I have a combobox with a few options included, however when I try to set the color of the marker to the text in the textbox, it can't "implicitly convert type string to GMarkerGoogleType". Is there a way to make this conversion?
Here is the relevant code:
private void btn_KMLFile_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog4.ShowDialog();
if (result == DialogResult.OK)
{
string filename = openFileDialog4.FileName;
string[] lines = System.IO.File.ReadAllLines(filename);
foreach (string line in lines)
{
GMarkerGoogleType MarkerColor = cbo_MarkerType.Text; //How can I convert this string to a GMarkerGoogleType?
string[] Data_Array = line.Split(',');
Double londecimal = Convert.ToDouble(Data_Array[0]);
Double latdecimal = Convert.ToDouble(Data_Array[1]);
var marker3 = new GMarkerGoogle(new PointLatLng(latdecimal, londecimal), MarkerColor);
marker3.IsVisible = true;
gMapOverlay.Markers.Add(marker3);
gmap.Update();
}
}
}
EDIT: This question is not a duplicate, the question can be rephrased as what type is a GMarkerGoogleType?