Click here to Skip to main content
15,921,837 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<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; 


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.
Posted
Updated 29-Jan-18 14:58pm
Comments
Karthik_Mahalingam 29-Jan-18 22:48pm    
windows or web?
try renaming the grid control name/id with 'dgLotData'

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900