您好社区,这是我的问题: 我有来自眼动仪数据的数组
string[] vals = new string[] {
timeStamp,
frame.ToString(),
sx.ToString(),
sy.ToString(),
px.ToString(),
py.ToString(),
pr.ToString(),
scx.ToString(),
scy.ToString()
};
我如何在其他阵列上添加“ scx”和“ scy”并以其他形式实时查看数据?
我正在尝试一些示例,但始终无法正常工作,向我显示“空”错误
所以我正在尝试:
在form2上,我创建两个数组,一个私有数组以保存数据,另一个创建公共数组以导入数据:
private string[] Scenary;
public string[] localScenary { get { return Scenary; } set { Scenary = value; } }
我的主要形式有数组,我称之为第二种形式的数据:
Matris mt = new Matris();
然后我转换我的数据:
ushort frame = BitConverter.ToUInt16(m_readBuffer, pos);
pos += 4;
float sx = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float sy = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float px = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float py = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float pr = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float scx = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
float scy = BitConverter.ToSingle(m_readBuffer, pos);
pos += 4;
//add all data on vals
string[] vals = new string[] {
timeStamp,
frame.ToString(),
sx.ToString(),
sy.ToString(),
px.ToString(),
py.ToString(),
pr.ToString(),
scx.ToString(),
scy.ToString()
};
ListViewItem item = new ListViewItem(vals);//show data on list
mt.localScenary = new string[] { scx.ToString(), scy.ToString() };//<--- here i calling my string to save the specific data
最后,我以其他形式调用具有特定数据的数组:
foreach (String myStr in Scenary)
{
MessageBox.Show(myStr);
}