Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    [C#]Richiamare form su altro files

    Ho sto cod:
    codice:
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using SiteManagerUtil;
    
    namespace Site_Manager
    {
    	/// <summary>
    	/// Summary description for Form1.
    	/// </summary>
    	public class Princ : System.Windows.Forms.Form
    	{
    		private System.Windows.Forms.Button btInsert;
    		private System.Windows.Forms.Button btCancella;
    		/// <summary>
    		/// Required designer variable.
    		/// </summary>
    		private System.ComponentModel.Container components = null;
    
    		public Princ()
    		{
    			//
    			// Required for Windows Form Designer support
    			//
    			InitializeComponent();
    
    			//
    			// TODO: Add any constructor code after InitializeComponent call
    			//
    		}
    
    		/// <summary>
    		/// Clean up any resources being used.
    		/// </summary>
    		protected override void Dispose( bool disposing )
    		{
    			if( disposing )
    			{
    				if (components != null) 
    				{
    					components.Dispose();
    				}
    			}
    			base.Dispose( disposing );
    		}
    
    		#region Windows Form Designer generated code
    		/// <summary>
    		/// Required method for Designer support - do not modify
    		/// the contents of this method with the code editor.
    		/// </summary>
    		private void InitializeComponent()
    		{
    			this.btInsert = new System.Windows.Forms.Button();
    			this.btCancella = new System.Windows.Forms.Button();
    			this.SuspendLayout();
    			// 
    			// btInsert
    			// 
    			this.btInsert.Location = new System.Drawing.Point(32, 8);
    			this.btInsert.Name = "btInsert";
    			this.btInsert.Size = new System.Drawing.Size(104, 24);
    			this.btInsert.TabIndex = 5;
    			this.btInsert.Text = "Inserisci";
    			this.btInsert.Click += new System.EventHandler(this.btInsert_Click);
    			// 
    			// btCancella
    			// 
    			this.btCancella.Location = new System.Drawing.Point(32, 48);
    			this.btCancella.Name = "btCancella";
    			this.btCancella.Size = new System.Drawing.Size(104, 24);
    			this.btCancella.TabIndex = 6;
    			this.btCancella.Text = "Cancella";
    			// 
    			// Princ
    			// 
    			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    			this.ClientSize = new System.Drawing.Size(160, 85);
    			this.Controls.AddRange(new System.Windows.Forms.Control[] {
    																		  this.btCancella,
    																		  this.btInsert});
    			this.Name = "Princ";
    			this.Text = "SiteManager";
    			this.ResumeLayout(false);
    
    		}
    		#endregion
    
    		/// <summary>
    		/// The main entry point for the application.
    		/// </summary>
    		[STAThread]
    		static void Main() 
    		{
    			Application.Run(new Princ());
    		}
    
    		private void btInsert_Click(object sender, System.EventArgs e)
    		{
    			Site_Manager.Insert inserisci = new Site_Manager.Insert();//Richiamo il form esterno
    		}
    	}
    }
    il files esterno è:
    codice:
     
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    
    namespace Site_Manager
    {
    	/// <summary>
    	/// Summary description for Insert.
    	/// </summary>
    	public class Insert : System.Windows.Forms.Form
    	{
    		private System.Windows.Forms.Label blTitolo;
    		private System.Windows.Forms.Label lbIndirizzo;
    		private System.Windows.Forms.TextBox txtTitolo;
    		private System.Windows.Forms.TextBox txtIndirizzo;
    		private System.Windows.Forms.Button btInsert;
    		/// <summary>
    		/// Required designer variable.
    		/// </summary>
    		private System.ComponentModel.Container components = null;
    
    		public Insert()
    		{
    			//
    			// Required for Windows Form Designer support
    			//
    			InitializeComponent();
    
    			//
    			// TODO: Add any constructor code after InitializeComponent call
    			//
    			Application.Run();
    		}
    
    		/// <summary>
    		/// Clean up any resources being used.
    		/// </summary>
    		protected override void Dispose( bool disposing )
    		{
    			if( disposing )
    			{
    				if(components != null)
    				{
    					components.Dispose();
    				}
    			}
    			base.Dispose( disposing );
    		}
    
    		#region Windows Form Designer generated code
    		/// <summary>
    		/// Required method for Designer support - do not modify
    		/// the contents of this method with the code editor.
    		/// </summary>
    		private void InitializeComponent()
    		{
    			this.blTitolo = new System.Windows.Forms.Label();
    			this.lbIndirizzo = new System.Windows.Forms.Label();
    			this.txtTitolo = new System.Windows.Forms.TextBox();
    			this.txtIndirizzo = new System.Windows.Forms.TextBox();
    			this.btInsert = new System.Windows.Forms.Button();
    			this.SuspendLayout();
    			// 
    			// blTitolo
    			// 
    			this.blTitolo.Location = new System.Drawing.Point(24, 16);
    			this.blTitolo.Name = "blTitolo";
    			this.blTitolo.Size = new System.Drawing.Size(56, 24);
    			this.blTitolo.TabIndex = 0;
    			this.blTitolo.Text = "Titolo";
    			// 
    			// lbIndirizzo
    			// 
    			this.lbIndirizzo.Location = new System.Drawing.Point(16, 48);
    			this.lbIndirizzo.Name = "lbIndirizzo";
    			this.lbIndirizzo.Size = new System.Drawing.Size(64, 24);
    			this.lbIndirizzo.TabIndex = 1;
    			this.lbIndirizzo.Text = "Indirizzo";
    			// 
    			// txtTitolo
    			// 
    			this.txtTitolo.Location = new System.Drawing.Point(72, 16);
    			this.txtTitolo.Name = "txtTitolo";
    			this.txtTitolo.Size = new System.Drawing.Size(120, 20);
    			this.txtTitolo.TabIndex = 2;
    			this.txtTitolo.Text = "";
    			// 
    			// txtIndirizzo
    			// 
    			this.txtIndirizzo.Location = new System.Drawing.Point(72, 48);
    			this.txtIndirizzo.Name = "txtIndirizzo";
    			this.txtIndirizzo.Size = new System.Drawing.Size(120, 20);
    			this.txtIndirizzo.TabIndex = 3;
    			this.txtIndirizzo.Text = "";
    			// 
    			// btInsert
    			// 
    			this.btInsert.Location = new System.Drawing.Point(72, 88);
    			this.btInsert.Name = "btInsert";
    			this.btInsert.TabIndex = 4;
    			this.btInsert.Text = "Inserisci";
    			// 
    			// Insert
    			// 
    			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    			this.ClientSize = new System.Drawing.Size(208, 125);
    			this.Controls.AddRange(new System.Windows.Forms.Control[] {
    																		  this.btInsert,
    																		  this.txtIndirizzo,
    																		  this.txtTitolo,
    																		  this.lbIndirizzo,
    																		  this.blTitolo});
    			this.Name = "Insert";
    			this.Text = "Inserisci Sito";
    			this.ResumeLayout(false);
    
    		}
    		#endregion
    	}
    	
    }
    Come richiamo sto form?
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  2. #2
    libreria esterna:
    codice:
    using System;
    using System.Collections;
    using SiteManagerUtil;
    
    namespace SiteManagerUtil
    {
    	/// <summary>
    	/// La classe principale
    	/// </summary>
    	public class SitMan 
    	{
    		/// <summary>
    		/// Le Variabili publiche
    		/// </summary>
    		public System.Collections.ArrayList nome;// il nome
    		public System.Collections.ArrayList indirizzo;// l'indirizzo
    		public const string fine = "http://";
    		/// <summary>
    		/// Valida l'url controllando se comincia per http:// altri menti lo appende
    		/// </summary>
    		/// <param name="url">L'url da validare</param>
    		/// <returns>L'url appeso</returns>
    		public string validaUrl(string url)
    		{
    			if(!url.StartsWith("http://"))
    			{
    				url = url + fine;
    			}
    			return url;
    		}
    		/// <summary>
    		/// La funzione che aggiunge un sito
    		/// </summary>
    		/// <param name="nm">Il nome del sito</param>
    		/// <param name="indir">L'indirizzo del sito</param>
    		/// <returns></returns>
    		public string aggiungi(string nm, string indir)
    		{
    			this.nome.Add(nm);
    			this.indirizzo.Add(indir);
    			return "";
    		}
    		/// <summary>
    		/// La funzione che cancella un sito
    		/// </summary>
    		/// <param name="nm">Il nome del sito</param>
    		/// <param name="indir">L'indirizzo del sito</param>
    		/// <returns></returns>
    		public string cancella(string nm, string indir)
    		{
    			this.nome.Remove(nm);
    			this.indirizzo.Remove(indir);
    			return "";
    		}
    	}//Fine SitMan
    
    }//Fine Namespace
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  3. #3
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  4. #4
    ho risolto con la proprietà .Visible settata a true
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.