c# 프로그래밍 질문

조회수 656회

private void btn_load_Click(object sender, EventArgs e) { StreamReader map; string inStr;

map = new StreamReader("C:/C#/waypoint.txt");

while (true)
{
    inStr = map.ReadLine();
    if (inStr == null)
        break;
    listBox1.Items.Add(inStr);
}
StreamReader map2;
map2 = new StreamReader("C:/C#/waypoint.txt");
for (int i = 0; i <= 2; i++)
{
    inStr = map2.ReadLine();
    string[] position = inStr.Split(' ');
    string a = position[0];
    string b = position[1];
    Double latitude = Double.Parse(a);
    Double longitude = Double.Parse(b);

    GMapMarker gMarker = new GMarkerGoogle(new PointLatLng(latitude, longitude), GMarkerGoogleType.blue_dot);
    MarkerOverlay.Markers.Add(gMarker);
    gMapControl1.Overlays.Add(MarkerOverlay);
}

}

코드를 실행하면 인덱스가 배열 범위를 벗어났다고 오류가 뜨는데 어디가 잘못된건지 모르겠습니다

2 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)