Any help ?
hdv212
Posts
-
Problem to create webPart dynamically! -
Problem to create webPart dynamically!Hi i have a simple web app which display some webparts from external assemblies. user can select available webParts and add to selected zone via this code :
Type type = _dicWebparts[this.ddlWebParts.SelectedValue];
WebPart webPart = (WebPart)Activator.CreateInstance(type);
this.WebPartManager1.AddWebPart(webPart, this.WebPartManager1.Zones[this.ddlZones.SelectedValue], 0); // cause error!!but as u see in the last line (where cause the problem), i'm facing this error :
System.InvalidOperationException: Cannot add a control of Type MyWebPart1.MyWebPart1. The Type must be loadable by BuildManager.GetType(string typeName).
How to solve this problem ? thanks in advance
-
How to hosting custom deisgner ?Many thanks henry i foud a good and simple resource in your link : Hosting Windows Forms Designers[^] it's very helpful for me, but my main problem is that i can save my designed form to xml file, but i can not load into my host designer and can not find any class to implement this functionality for me. i'm looking for loading/saving host designed form at runTime.
-
How to hosting custom deisgner ?Hi i'm looking for someone or blog which have experience to this topic.
-
How to hosting custom deisgner ?Hi i have a several problems with hosting designer within my app. i've found some useful articles such as this[^] and this[^], but my problem does not solved and this codes is very complex. can anybody help me give me a site, blog or someone which have an experience in hosting designer topics ? thanks in advance
-
Problem to implement designer at runTime.Hi do u have problem to download my sample file ? do u have live account ?
-
Problem to implement designer at runTime.Hi i found several example and source codes to demonstrate this, but all of them create a some new classes and write more complex code. here is some examples : http://msdn.microsoft.com/en-us/magazine/cc163634.aspx[^] Design Time Architecture in .NET 2.0 - Part 1[^]
-
Problem to implement designer at runTime.Hi do u have problem to download from this link ? http://cid-1490cc59dd735cbf.office.live.com/self.aspx/.Public/Designer2.rar[^] i found several example and source codes to demonstrate this, but all of them create a some new classes and write more complex code. here is some examples : http://msdn.microsoft.com/en-us/magazine/cc163634.aspx[^] Design Time Architecture in .NET 2.0 - Part 1[^]
-
Problem to implement designer at runTime.Hi i want to implement deisgner at runTime in my app, to do this i 've create a simple win app and write this code to my form :
public partial class Form1 : Form
{
IServiceContainer isc;
DesignSurface ds;
IDesignerHost idh;
ISelectionService iss;
IToolboxUser itu;
MyToolBox toolbox;public Form1()
{
// Create the DesignSurface and load it with a form
isc = new ServiceContainer();
ds = new DesignSurface(isc);
ds.BeginLoad(typeof(Form));idh = (IDesignerHost)ds.GetService(typeof(IDesignerHost));
iss = (ISelectionService)ds.GetService(typeof(ISelectionService));
itu = (IToolboxUser)idh.GetDesigner(idh.RootComponent);InitializeComponent();
iss.SelectionChanged += new EventHandler(iss_SelectionChanged);
}private void Form1_Load(object sender, EventArgs e)
{
toolbox = new MyToolBox();
toolbox.Dock = DockStyle.Fill;
splitContainer1.Panel1.Controls.Add(toolbox);
isc.AddService(typeof(IToolboxService), toolbox);// Get the View of the DesignSurface, host it in a form, and show it
Control c = ds.View as Control;
c.Parent = this.splitContainer2.Panel1;
c.Dock = DockStyle.Fill;
}private void iss_SelectionChanged(object sender, EventArgs e)
{
propertyGrid1.SelectedObject = iss.PrimarySelection;
}
}and also create a new class named 'ToolboxServiceImp' which inherits from ListBox and IToolboxService as follow : Please download my sample app from http://cid-1490cc59dd735cbf.office.live.com/self.aspx/.Public/Designer2.rar my problem is that, at runTime when i drag & drop a control from my toolbox on the form, i got this error : Error --------------------------- Unable to cast object of type 'System.RuntimeType' to type 'System.Drawing.Design.ToolboxItem'. --------------------------- OK also, when i click on form, i got this error and designer become corrupt : Error --------------------------- The control System.Windows.Forms.Form has thrown an unhandled exception in the designer and has been disabled. Exception: Unable to cast object of type 'System.RuntimeType' to type 'System.Drawing.Design.ToolboxItem'. Stack trace: --------------------------- OK where is my problem and how to solve it ? thanks in advance
-
Problem to update hierarchical data and display it in treeView.Thanks Mycroft but still i have the same problem.
-
Problem to update hierarchical data and display it in treeView.Hi i have a simple app which display emplyees organization chart from northwind database. here is my code to accomplish this :
private void btnLoadData_Click(object sender, EventArgs e)
{
this.treeView1.Nodes.Clear();this.\_dtEmployees = this.GetEmployees(); this.FillHieraricalData(this.\_dtEmployees, this.treeView1, "LastName", "EmployeeID", "ReportsTo"); this.treeView1.ExpandAll();
}
private DataTable GetEmployees()
{
DataTable dt = new DataTable();using (SqlConnection con = new SqlConnection(Properties.Settings.Default.NorthwindConnectionString)) { SqlCommand cmd = con.CreateCommand(); cmd.CommandText = "select \* from employees"; con.Open(); dt.Load(cmd.ExecuteReader()); con.Close(); } return dt;
}
private void FillHieraricalData(DataTable dt, TreeView treeView, string infoColumnName,
string pkColumnName, string parentColumnName)
{
TreeNode node = null;
foreach (DataRow row in dt.Rows)
{
node = new TreeNode(row[infoColumnName].ToString());
node.Tag = row[pkColumnName];if (row\[parentColumnName\] != DBNull.Value) { List<TreeNode> foundNodes = new List<TreeNode>(); // search over treeView nodes to found parent of row (if exists) SearchNodeInTreeView(treeView.Nodes, Convert.ToInt32(row\[parentColumnName\]), foundNodes); if (foundNodes.Count > 0) foundNodes\[0\].Nodes.Add(node); } else // if row parent does not exists, then it's parent itself (or it's root), it should add to level 0 of treeView treeView.Nodes.Add(node); }
}
// this method search in treeView.Nodes to find specific nodes base on 'value'
private void SearchNodeInTreeView(TreeNodeCollection nodesToSearch, int value, List<TreeNode> foundNodes)
{
for (int i = 0; i < nodesToSearch.Count; i++)
{
if (Convert.ToInt32(nodesToSearch[i].Tag) == value)
foundNodes.Add(nodesToSearch[i]);//Recursively search in the child nodes SearchNodeInTreeView(nodesToSearch\[i\].Nodes, value, foundNodes); }
}
However, when i update data in memory (via dataTable) and redisplay data in treeView, the row that has been modfied has been removed from treeView and not display. for example, when i change 'Reports To' of any employee, that employee does not display in treeView! here
-
Critical Problem : MyTableAdapter.Adapter.SelectCommand is null.Hi it's simply creating new tableAdapter object from my tableAdapter class like this :
InstitutionDataSetTableAdapters.BookSalesHeaderTableAdapter adapter = new Institution.InstitutionDataSetTableAdapters.BookSalesHeaderTableAdapter();
//adapter.Adapter.SelectCommand is null at runtime -
Critical Problem : MyTableAdapter.Adapter.SelectCommand is null.Hi i'm working with dataSetDesigner in my app,lately when i create a new tableAdapter, it's select command is null at runTime, but it configure correctly in dataSetDesigner. where is my problem and how to solve it ? thanks
-
How to send & receive sms via gsm modem ?Hi no, i don't want to use any third party controls, i want to create my own. can u help me ?
-
How to send & receive sms via gsm modem ?Hi i'm looking for good library or source code which implement send/receive sms via gsm modem. i found this article[^] and it's good, but unfortunately it does not support delivery event handler when sms deilvered. can anybody help me and provide better library or source code which support more events ? thanks in advance
-
workflow question : need wfmc standard tables definitions. -
Problem to add new type to external assembly via System.Reflection.EmitHi i've added some types to an external assembly as well, but it's original types overwritten. is there any way to add new types without overwrite it's original types ? thanks in advance
-
Problem to save assembly via System.Reflection.Emit.Hi I've used from this link to define a new simple type and then save to disk with .dll extension via this code :
private void button1_Click(object sender, EventArgs e)
{
AssemblyName asmName = new AssemblyName();
asmName.Name = "HelloWorld";AssemblyBuilder asmBuilder = Thread.GetDomain().DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule("HelloWorld"); TypeBuilder typeBuilder = modBuilder.DefineType("Hello", TypeAttributes.Public, typeof(object), new Type\[\] { typeof(IHello) }); MethodBuilder methodBuilder = typeBuilder.DefineMethod("SayHello", MethodAttributes.Private | MethodAttributes.Virtual, typeof(void), new Type\[\] { typeof(string) }); typeBuilder.DefineMethodOverride(methodBuilder, typeof(IHello).GetMethod("SayHello")); ILGenerator il = methodBuilder.GetILGenerator(); // string.Format("Hello, {0} World!", toWhom) il.Emit(OpCodes.Ldstr, "Hello, {0} World!"); il.Emit(OpCodes.Ldarg\_1); il.Emit(OpCodes.Call, typeof(string).GetMethod("Format", new Type\[\] { typeof(string), typeof(object) })); // Console.WriteLine("Hello, World!"); il.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type\[\] { typeof(string) })); il.Emit(OpCodes.Ret); Type type = typeBuilder.CreateType(); IHello hello = (IHello)Activator.CreateInstance(type); hello.SayHello("Emit"); asmBuilder.Save(asmName.Name + ".dll");
}
it saved my dll on disk, but when i open it via Reflector, it does not have anything! just have a module named 'RefEmit_OnDiskManifestModule' can anybody help me where is my problem and how to solve it ? thanks in advance
-
Automatic page generation.Thanks Alexei Rodriguez
-
Automatic page generation.Hi Kannan Ar no, i don't do that. i want to create a web application base on database schema, my app generate pages for that web application which do CRUD commands for each objects that user selected (New, Edit, Display and ShowList pages for each table/view). i want to generate these pages automaticallu to free developer from hard coding for CRUD scenarios.