What I want to do is pass the elements stored in a listbox to a two-dimensional array to later calculate centroids, I've tried but I go line by line instead of element by element
OpenFileDialog abrir = new OpenFileDialog();
String ruta;
abrir.Title = "Seleccionar fichero";
abrir.Filter = "Documentos de texto (*.txt)|*.txt" + "|Todos los archivos (*.*)|*.* ";
abrir.FileName = this.boxexaminar.Text;
if (abrir.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.boxexaminar.Text = abrir.FileName;
}
ruta = boxexaminar.Text;
StreamReader sr = new StreamReader(Convert.ToString(ruta));
while (sr.Peek() >= 0)
{
showdata.Items.Add(Convert.ToString(sr.ReadLine()));
}
sr.Close();
String[] matriz = new String[showdata.Items.Count];
for (int i = 0; i < showdata.Items.Count; i++)
{
matriz[i] = showdata.Items[i].ToString();
}
showclases.Text = Convert.ToString(matriz[0]);