It seems I need to import Accessibility also so that it works with the new version. A more detailed error message would be nice .:(
But now I get the same error in this script when it gets into "private var myData: DataTable"; part:
import System; import System.Windows.Forms; //import System.ComponentModel; import System.Drawing; import Accessibility; import System.Data; import System.Data.SqlClient; package ResizeMe { class PanelForm extends System.Windows.Forms.Form { private var panel1: Panel; private var label1: Label; private var myDataForm: DataGridView; private var myData: DataTable; // !!! private var connectionString: String; private var selectCommand: String; private var dataAdapter: SqlDataAdapter; private var commandBuilder: SqlCommandBuilder; function PanelForm() { this.Text= "Anchoring Demo: Resize Me"; try { selectCommand = "SELECT * FROM dbo.Deities"; connectionString = "Integrated Security=SSPI;Persist Security Info=False;" + "Initial Catalog=protos;Data Source=localhost" dataAdapter = new SqlDataAdapter(selectCommand, connectionString); commandBuilder = new SqlCommandBuilder(dataAdapter); // myData = new DataTable(); // myData.Locale = System.Globalization.CultureInfo.InvariantCulture; // dataAdapter.Fill(myData); // !!! // myDataForm = new DataGridView(); // myDataForm.DataSource = myData; // myDataForm.Location= new Point(100,100); // myDataForm.Size= new System.Drawing.Size(100,100); } catch (e:SqlException) { // MessageBox.Show("To run this example, replace the value of the " + // "connectionString variable with a connection string that is " + // "valid for your system."); } label1= new Label; label1.Location= new Point(10,10); label1.Size= new System.Drawing.Size(80,20); label1.Name= "label1"; label1.Text= "This is a Label"; panel1= new Panel; panel1.Location= new Point(0,0); panel1.Size= new System.Drawing.Size(300,300); panel1.Name= "This is a Panel"; panel1.Anchor= AnchorStyles.Top | AnchorStyles.Left; panel1.Controls.Add(label1); panel1.Controls.Add(myDataForm); this.Controls.Add(panel1); } } } Application.Run(new ResizeMe.PanelForm());
Any clues what am I missing?
[edit] FYI, during development, use jsc.exe, which is included in the v2.0.50727.NET Framework, as it causes detailed errors that are really useful. If necessary, you can always switch to newer versions for final assembly. This solved my problem.
source share