Why is this required to be public?

  • Thread starter Thread starter Robert in SF
  • Start date Start date
R

Robert in SF

Guest
I don't understand why I can't set everything to private. None of this is supposed to be accessed from outside the class, and I thought private meant everything within the class could access it. Thanks for the explanation.

public partial class MainForm : Form
{
private struct PDFentry
{
// why do I get "inaccessible" error if set to private?
public string FileName { get; set; }
public int PageCount { get; set; }
public string PageSizes { get; set; }
public string Error { get; set; }
}

private BindingList<PDFentry> PDFList = new BindingList<PDFentry>();

private struct PDFUndo
{
public int row { get; set; }
public PDFentry thePDF { get; set; }
}

private Stack<PDFUndo> undoStack = new Stack<PDFUndo>();

public MainForm()
{
InitializeComponent();
filesDataGridView.AutoGenerateColumns = false;
filesDataGridView.DataSource = filesBindingSource;
filesBindingSource.DataSource = PDFList;
filesDataGridView.Columns["FileName"].DataPropertyName = "FileName";
filesDataGridView.Columns["PageCount"].DataPropertyName = "PageCount";
filesDataGridView.Columns["PageSizes"].DataPropertyName = "PageSizes";
filesDataGridView.Columns["Error"].DataPropertyName = "Error";
}

Continue reading...
 
Back
Top