这是我在百度知道发表的提问
http://zhidao.baidu.com/question/436852705.html?quesup2&oldq=1
想这问题想的头晕,不小心点错了。直接采纳了。 我对自己无语了。 但问题没有解决。
这是Form1.cs中的代码public void setData(string time, string username,string name,string type,string leibie,string money,string moneylast )
{
dataGridView1.Rows[rowIndex].Cells["Column1"].Value = time;
dataGridView1.Rows[rowIndex].Cells["Column2"].Value = username;
dataGridView1.Rows[rowIndex].Cells["Column3"].Value = name;
dataGridView1.Rows[rowIndex].Cells["Column4"].Value = type;
dataGridView1.Rows[rowIndex].Cells["Column5"].Value = leibie;
dataGridView1.Rows[rowIndex].Cells["Column6"].Value = money;
dataGridView1.Rows[rowIndex].Cells["Column7"].Value = moneylast;
rowIndex++;
}Form2.cs 中的代码Form2 mf = (Form2)this.Owner;
mf.setData(System.DateTime.Now.ToString(), textBoxAccount.Text, textBoxName.Text, comboBoxString.Text, type, textBoxInitMoney.Text, textBoxInitMoney.Text);
我的代码不对,但又不知道怎么解决。各位网友帮忙看一下。
http://zhidao.baidu.com/question/436852705.html?quesup2&oldq=1
想这问题想的头晕,不小心点错了。直接采纳了。 我对自己无语了。 但问题没有解决。
这是Form1.cs中的代码public void setData(string time, string username,string name,string type,string leibie,string money,string moneylast )
{
dataGridView1.Rows[rowIndex].Cells["Column1"].Value = time;
dataGridView1.Rows[rowIndex].Cells["Column2"].Value = username;
dataGridView1.Rows[rowIndex].Cells["Column3"].Value = name;
dataGridView1.Rows[rowIndex].Cells["Column4"].Value = type;
dataGridView1.Rows[rowIndex].Cells["Column5"].Value = leibie;
dataGridView1.Rows[rowIndex].Cells["Column6"].Value = money;
dataGridView1.Rows[rowIndex].Cells["Column7"].Value = moneylast;
rowIndex++;
}Form2.cs 中的代码Form2 mf = (Form2)this.Owner;
mf.setData(System.DateTime.Now.ToString(), textBoxAccount.Text, textBoxName.Text, comboBoxString.Text, type, textBoxInitMoney.Text, textBoxInitMoney.Text);
我的代码不对,但又不知道怎么解决。各位网友帮忙看一下。
解决方案 »
- 继续散分 关于 Photoshop PSD文件
- vs2005编译的release版本 为何在没有开发环境的机器上 有的功能无法弹出窗口呢? 无法弹出的都是引用的一个dll组件中的。在有开发环境的机器上什么都可以呢?该怎么解决呢
- 一个练习题求助
- c#中如何编写COM组件(要求能被DELPHI调用)
- wince程序头疼
- inkcanvas中的ink的颜色怎么能以一幅图为背景
- 虚方法的使用?
- C#窗体应用程序求素数,为什么非素数不输出?求高手指点
- 求Beginning Visual C# 电子版下载^0^
- vs.net开发环境下的一个问题(微软专家及高手请进)。
- 求一个正则表达式
- 正由另一进程访问的【进程】能查找出来的吗?
{
datagridview1.Rows.Add();
int rowIndex = datagridview1.RowCount - 1;
DataGridViewRow row = datagridview1.Rows[rowIndex];
row.Cells["Column1"].Value = ...
...
}
Form2.cs的代码中为 为Form1中的dataGirdview控件插入行。
Form1 和Form2 没有联系,唯一的联系是Form2 中有一button按钮,点击后可以为Form1中dataGridview插入行。此问题如何处理。(涉及到了不同Form间的访问)。
{
int index = this.dataGridView2.Rows.Add();
dataGridView1.Rows[index].Cells["Column1"].Value = time;
dataGridView1.Rows[index].Cells["Column2"].Value = username;
dataGridView1.Rows[index].Cells["Column3"].Value = name;
dataGridView1.Rows[index].Cells["Column4"].Value = type;
dataGridView1.Rows[index].Cells["Column5"].Value = leibie;
dataGridView1.Rows[index].Cells["Column6"].Value = money;
dataGridView1.Rows[index].Cells["Column7"].Value = moneylast;
}rowIndex 不用了
public void setData(string time, string username, string name, string type, string leibie, string money, string moneylast)
{
int index = this.dataGridView1.Rows.Add();
dataGridView1.Rows[index].Cells["Column1"].Value = time;
dataGridView1.Rows[index].Cells["Column2"].Value = username;
dataGridView1.Rows[index].Cells["Column3"].Value = name;
dataGridView1.Rows[index].Cells["Column4"].Value = type;
dataGridView1.Rows[index].Cells["Column5"].Value = leibie;
dataGridView1.Rows[index].Cells["Column6"].Value = money;
dataGridView1.Rows[index].Cells["Column7"].Value = moneylast;
}