DatagridView error

DatagridView error

Anonymous
Not applicable
669 Views
3 Replies
Message 1 of 4

DatagridView error

Anonymous
Not applicable

This is my first time working with forms, I created a form with Datagrid and it has 3 columns Sheet_Num, Sheet_Discipline, and Sheet_Title_1. I am having an issue with accessing the datagrid from the form in my application programming. When i try accessing from thisForm i have warnings that says "'SheetCreator.Form1.Sheet_Discipline' is inaccessible due to its protection level (CS0122) -". It also is unable to access datagridview1 in the foreach statement. What does that mean? and how do i remove the protection level?

 

public void SheetCreator()
		{
			UIDocument uidoc = this.ActiveUIDocument;
			Document doc = uidoc.Document;
			
			string Sheetnum="";
			string SheetDisc="";
			string sheetTitle="";
			string sheetname="";
			
			using (Form1 thisForm = new Form1())
			{
				thisForm.ShowDialog();
				
				Sheetnum=thisForm.Sheet_Num();
				SheetDisc=thisForm.Sheet_Discipline();
				sheetTitle=thisForm.Sheet_Title_1();
				sheetname= string.Concat(SheetDisc," ",sheetTitle);
				{
				foreach (DataGridViewRow row in thisForm.dataGridView1.Rows);
					Transaction t = new Transaction(doc, "Create Sheets");
					t.Start();
					ViewSheet sheet = ViewSheet.Create(Sheetnum,sheetname);
					t.Commit();

 

0 Likes
670 Views
3 Replies
Replies (3)
Message 2 of 4

Aaron.Lu
Autodesk
Autodesk
Dear, this should be more like a c# problem not a RevitAPI problem.

what is 'Sheet_Discipline', a function or a property? public or protected or private?


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 4

Anonymous
Not applicable
Sheet_Discipline is one of the columns in my datagrid. It will ultimately be a parameter value in the sheets I create.
0 Likes
Message 4 of 4

Aaron.Lu
Autodesk
Autodesk
see this: https://msdn.microsoft.com/en-us/library/vstudio/ha94aebs(v=vs.100).aspx


it should be a c# problem


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes