我想根据列头的名字获取不同的数据用于处理.我刚学,不太明白,请高手指教
解决方案 »
- windows ce的移动设备需要连接server 的数据库,这样的东西怎么弄呢?
- .NET如何获取win7和VISTA管理员权限
- 请教ADO.NET中SqlParameter类的用法
- 如何用系统时间覆盖SQL中DateTime字段时间
- c#中如何做象word那样的特殊符号插入工具
- SqlConnection conn = dinner.DBConn.CyCon();conn.Open();错在open()这里。请教高手指教。谢谢!
- 高分 求 画日历
- 哪句代码造成了CPU的损耗(代码不多)
- 请高手指定,关于MCI编程
- Win2000启动的时候要同时按下Ctrl Alt Del 能不能写代码修改成 同时按下 A B C 三个键来启动系统
- 应用程序共享
- 求高人指点,打印的问题?
dataGridView1.Columns[0].Name
dataGridView1.Columns[1].HeaderCell.Value = "姓名"; //第二列
int sam= dataGridView1.RowCount;
int V=0;
for (int iV = 0; iV < sam - 1; iV++)
{
strVoltage[V] = dataGridView1[ 0,iV].Value.ToString();
V++;
}
但是调试时 为何出错
这句改成下面这句看看
if(dataGridView1[ 0,iV].Value!=null)
strVoltage[V] = dataGridView1[ 0,iV].Value.ToString();
Message="未将对象引用设置到对象的实例。"
Source="电池检测软件"
StackTrace:
在 电池检测软件.frmlishishuju.trvlishi_NodeMouseDoubleClick(Object sender, TreeNodeMouseClickEventArgs e) 位置 E:\电池检测软件\电池检测软件\frmlishishuju.cs:行号 228
在 System.Windows.Forms.TreeView.OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e)
在 System.Windows.Forms.TreeView.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 电池检测软件.Program.Main() 位置 E:\电池检测软件\电池检测软件\Program.cs:行号 18
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
是不是strVoltage数组没有new吧
如:strVoltage=new string[sam];
string[] strVoltage = new string[sam];
int V=0;
for (int iV = 0; iV < sam - 1; iV++)
{
if(dataGridView1[ 0,iV].Value!=null)
strVoltage[V] = dataGridView1[ 0,iV].Value.ToString();
V++;
}