解决方案 »
- 怎么样修改 propertygrid 里面的属性?
- 浏览器载入一个aspx页面时GridView1如何绑定先显示空字段名?
- 大家有会FLASH的嘛,帮我解决个问题,FLASH怎么去XML里的值啊
- 关于switch的问题
- asp.net 刷新页面
- 请教大家,如何给UserControl传递参数??
- 紧急问题!!!!
- 怎么在C#中用到数学函数,我想用using system.math为什么没有呢?
- 求教水晶报表问题?Load report failed (重发)
- FTPComm控件的使用时候,如何确定操作完成??
- 自己做了一个小程序,请教其中Timer的原理
- ASP.NET 前台页面某一属性值在后台CS中定义
private void button1_Click(object sender, EventArgs e)
{
Thread thr = new Thread(new ParameterizedThreadStart(TestRun));
thr.IsBackground = true;
object o = 1;
//object o = new object[] { "a", 1 };//多参
thr.Start(o);
}
private void TestRun(object o)
{
int i = (int)o;
//object[] os = (object[])o;
//string str = os[0].ToString();
//int i = (int)os[1];
}
{
while (true)
{
string txt = System.DateTime.Now.ToString() + " 执行第 " + index.ToString() + " 个线程";
if (listBox1.InvokeRequired)
{
MyDelegateUI d = delegate
{
listBox1.Items.Insert(0, txt);
};
listBox1.Invoke(d);
}
else
{
listBox1.Items.Insert(0, txt);
} System.Threading.Thread.Sleep(100);
}
} private void button1_Click(object sender, EventArgs e)
{
Thread[] t = new Thread[10];
for (int i = 0; i < 10; i++)
{
t[i] = new Thread(new ParameterizedThreadStart(fun));
t[i].Start(i);
}
}
这个看得懂,但你看一下,我这个怎么弄呢 #region [方法]【得到表格数据】
public void getData(out DataTable dt, out SqlDataAdapter da, out SqlCommandBuilder sb, out BindingSource bs, ToolStripStatusLabel st1, string sqlcmd, BindingNavigator bindNager)
{ SqlConnection conn = null;
string connect =Maticsoft.DBUtility.DbHelperSQL.connectionString;
da = null;
da = null;
sb = null;
bs = null;
try
{
conn = new SqlConnection(connect);
if (conn.State == ConnectionState.Closed)
{
conn.Open();
} dt = new DataTable();
da = new SqlDataAdapter(sqlcmd, conn);
sb = new SqlCommandBuilder(da);
da.Fill(dt);
Grid.DataSource = bs;
bs = new BindingSource();
bs.DataSource = dt;
grid.DataSource = bs;//这里要操作控件
}
catch (Exception ex )
{
MessageBox.Show(ex.ToString ());
}
finally
{
conn.Close();
}
}
#endregion
==> this.Invoke(new MethodInvoker(delegate
{
grid.DataSource = bs;//这里要操作控件 }));