索引超出范围。必须为非负值并小于集合大小。参数名:index
程序代码:
private void OnNewPacket(PacketMonitor pm, Packet p) { // add the new packet to the list m_Packets.Add(p); m_PacketsSize += p.TotalLength; this.lvShowData.Items.Add(new ListViewItem(new string[] { p.Time.ToString(), p.Source,p.Destination,p.Protocol.ToString(), p.TotalLength.ToString() })); this.statusBar1.Text="总共收到数据包为:"+m_PacketsSize.ToString()+"个"; } private void btnStop_Click(object sender, System.EventArgs e) { m_PacketMonitors.Stop(); } private void btnReset_Click(object sender, System.EventArgs e) { this.lvShowData.Items.Clear(); this.tbShowData.Text=""; } private void lvShowData_DoubleClick(object sender, System.EventArgs e) { ListView l = (ListView)sender; if (l.SelectedItems.Count> 0) { Packet p=(Packet)m_Packets[l.SelectedItems[0].Index]; this.tbShowData.Text=p.ToString(); } } private void 作者_Click(object sender, System.EventArgs e) { MessageBox.Show("作者:岳国兵\nQQ:32151611"); } } }[local]1[/local]
最好给我修改好以后的答案, 3Q
[ 本帖最后由 jialong8 于 2011-5-27 21:07 编辑 ]