Witam
Jestem poczatkujacym programista i mam problem z takim kodem
public static string[] czytaj_polozenie()
{
odczyt = port_res.ReadExisting();
Res.res = Res.odczyt.Split(',');
res[0]=res[0].Replace('.',',');
res[1]=res[1].Replace('.',',');
res[2]=res[2].Replace('.',',');
return res;
}
Chodzi o to ze czytam dane z RS232 w postaci xx.xxxx,xx.xxxxx,xx.xxxxx gdzie x to cyfry
i ta funcja ... wiadomo co robi .. potem dane te wswietlam na formie w textboxach
void Timer1Tick(object sender, System.EventArgs e)
{
Res.res=Res.czytaj_polozenie();
tb_res1.Text=Res.res[0];
tb_res2.Text=Res.res[1];
tb_res3.Text=Res.res[2];
}
jak na razie wszystko ok Problem pojawia sie gdy chce zrobic to samo w innym miejscu programu
public static void start(int ilosc_projekcji,int odstep_czasu)
{
do
{
jakas_funkcja()
Res.res=Res.czytaj_polozenie();
}
while (Convert.ToDouble(Res.res[0]) > 2.0 );
}
przy uruchomieniiu tej f-cji wywala blad
"Wyjątek System.IndexOutOfRangeException został wywołany w debugowanym:
Index was outside the bounds of the array." :/
Przeciez nie wychodze poza index tabeli ???
bardzo prosze o pomoc