do fullpath('kodnet.prg')>
>TEXT TO m.code noshow >using System; >using System.Data; >using System.Data.Linq; >using System.Data.Linq.Mapping; >using System.Data.SqlClient; >using System.Windows.Forms; >using System.Drawing; >using System.Xml.Serialization; > >public class program{ > public static void main(){ > } >} >namespace Compiled >{ > public class Test > { > > public System.Windows.Forms.Form GetForm() > { > string constr = @"server=.\SQLexpress2012;trusted_connection=yes;database=Northwind"; > DataSet ds = new DataSet(); > var catAdapter = new SqlDataAdapter("select * from Categories",constr); > catAdapter.Fill(ds, "Categories"); > > //var c2p = ds.Relations.Add("Cat2Products", > //ds.Tables["Categories"].Columns["CategoryId"], > //ds.Tables["Products"].Columns["CategoryId"]); > > Form f = new Form { Text = "ComboBox ornek", Height = 200, Width = 500 }; > ComboBox cb1 = new ComboBox { Left = 10, Top = 10, Width = 450, Font = new Font("Courier New", 8) }; > ComboBox cb2 = new ComboBox { Left = 10, Top = 60, Width = 450, Font = new Font("Courier New", 8) }; > > f.Controls.AddRange(new Control[] { cb1, cb2 }); > > cb1.DataSource = ds.Tables["Categories"]; > cb1.ValueMember = "CategoryId"; > cb1.DisplayMember = "CategoryName"; > cb1.SelectedIndex = -1; > > cb1.SelectedIndexChanged += (sender, args) => > { > > var selectedValue = ((ComboBox)sender).SelectedValue; > cb2.DataSource = null; > cb2.Items.Clear(); > DataTable tbl = new DataTable(); > var prodAdapter = new SqlDataAdapter("select * from Products where CategoryId = @id", constr); > prodAdapter.SelectCommand.Parameters.Add("@id", SqlDbType.Int).Value = selectedValue; > prodAdapter.Fill(tbl); > > cb2.DataSource = tbl; > cb2.DisplayMember = "ProductName"; > cb2.ValueMember = "ProductId"; > }; > > return f; > } > } >} >ENDTEXT > >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.Linq.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Drawing.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.Serialization.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll") >_Screen.dotnet4.loadAssemblyFile("C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.Entity.dll") > > >LOCAL engine > >* COMPILE C# CODE >Local asem, test, person > >engine= _screen.kodnet.getStaticWrapper("jxshell.csharplanguage").construct() >m.engine.Runscript(m.code) >asem = m.engine.getCompiledAssembly() >_Screen.kodnet.loadAssembly(m.asem) > > >* now you can use the type compiled >test= _screen.kodnet.getStaticWrapper("Compiled.Test").construct() >frm = test.GetForm() >frm.ShowDialog() >>