“名称”dglotdata"的错误在当前上下文中不存在 [英] Error of "the name "dglotdata" does not exist in the current context

查看:90
本文介绍了“名称”dglotdata"的错误在当前上下文中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="c#">
            dtLots.Columns.Add(ISSELECTED, typeof(Boolean)).SetOrdinal(0);
            dtLots.Columns.Add(TESTMODE, typeof(string));
            dtLots.Columns.Add(TESTDIRPATH, typeof(string));
            dtLots.Columns.Add(TLTPATH, typeof(string));
            dtLots.Columns.Add(PROGRAM, typeof(string));
            dtLots.Columns.Add(TIMESTAMP, typeof(string));

            dgLotData.DataSource = dtLots.DefaultView; 





你好。我有一个未声明的变量dgLotData的错误。我该如何解决这个问题?谢谢!



我尝试了什么:



试图申报dgLotData但仍然不能。



Hello. I have an error of undeclared variable dgLotData. How do I solve that problem? Thank you!

What I have tried:

tried to declare the dgLotData but still can't.

推荐答案

这是一个非常基本且自我解释的错误。如果您正在复制和粘贴代码而不试图理解它的作用,那么您自己就是一种伤害。一个简单的谷歌搜索,你可能有更多的可能自己解决这个错误,这也可以帮助你了解自己解决问题的重要性。



鉴于我对您的项目一无所知,也没有提供大量的代码片段,我只能假设您正在使用数据网格视图。



如果您参考这个链接



DataGridView.DataSource属性(System.Windows.Forms) [ ^ ]



那里是一个代码片段,向您展示如何声明数据网格视图,这是您遇到的错误。
This is a pretty basic and self explanatory error. If you are copying and pasting code without attempting to understand what it does you are doing yourself a disservice. A simple google search and you would have more than likely resolved this error on your own which would have also helped you learn how important figuring things out on your own is.

Given I don't know anything about your project nor did you provide much of a code snippet I can only assume you are using a data grid view.

If you reference this link

DataGridView.DataSource Property (System.Windows.Forms)[^]

There is a code snippet that shows you how to declare a data grid view which is what the error you are running into.


这篇关于“名称”dglotdata&quot;的错误在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆