Message 1 of 3
How to use a Copy Jig for an Entity Array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am able to populate dataGridView1 with an attribute list.
I am attempting to pass that from the column 3 of dataGridView1 back to mycommands class without luck.
Code attached.
//****Located in form1**** private void button4_Click(object sender, EventArgs e) { MyCommands ObjCommands = new MyCommands(); gridarray(); var doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument; if (doc != null) { //doc.SendStringToExecute("THWU", true, false, false); doc.SendStringToExecute("TEST1\n", false, false, false); } // Command Send End } public void gridarray() { MyCommands ObjCommands = new MyCommands(); //string[] column0Array = new string[dataGridView1.Rows.Count]; column1Array = new string[dataGridView1.Rows.Count]; column2Array = new string[dataGridView1.Rows.Count]; int i = 0; foreach (DataGridViewRow row in dataGridView1.Rows) { //column0Array[i] = row.Cells[0].Value != null ? row.Cells[0].Value.ToString() : string.Empty; column1Array[i] = row.Cells[1].Value != null ? row.Cells[1].Value.ToString() : string.Empty; column2Array[i] = row.Cells[2].Value != null ? row.Cells[2].Value.ToString() : string.Empty; i++; } System.Windows.Forms.MessageBox.Show("grid xy"); // foreach (string MsgName in column2Array) //{ // System.Windows.Forms.MessageBox.Show(MsgName); // } ObjCommands.column2Array = column2Array; } //****Located in My Commands Class**** [CommandMethod("TEST1")] public void ListTest() //Commands AcadCommands = new MyCommands(); //Form1 objForm1 = new Form1(); { PickBlock(); Form1 ObjForm1 = new Form1(); // column2Array = column2Array; column2Array = ObjForm1.column2Array; System.Windows.Forms.MessageBox.Show("here"); foreach (string MsgName in column2Array) { System.Windows.Forms.MessageBox.Show(MsgName); } System.Windows.Forms.MessageBox.Show("xxx"); //string[] AttStringChglist; //AttStringChglist = ObjForm1.column2Array; //AttStringChglist = ObjForm1.column2Array; }//End list test
I think should be see the array members in that foreach member box in mycommands but that is not the case
What is the solution to this?.
Image of form1 is showen