0
編譯我的網格視圖以顯示一組訂單時,我得到索引超出範圍異常。c#>索引超出範圍。必須是非負數並且小於集合的大小
它不返回所有行。它只返回一行
任何幫助,非常感謝。
try
{
oClient.Connect(oServer);
MailInfo[] infos = oClient.GetMailInfos();
Console.WriteLine(infos.Length);
for (int i = 0; i < infos.Length; i++)
{
MailInfo info = infos[i];
Mail oMail = oClient.GetMail(info);
dgView_Inbox.Rows[i].Cells[0].Value = oMail.From.ToString();
dgView_Inbox.Rows[i].Cells[1].Value = oMail.Subject.ToString();
}
oClient.Quit();
}
catch (Exception ep)
{
Console.WriteLine(ep.Message);
}
在你得到什麼線異常? –
你的datagridview中有沒有行? – Steve
你有多少個預定義的行,你有郵件嗎? – Dunken