Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 17
  1. #1

    [C#] primo form creato con shrpDevelop

    using System;
    using System.Windows.Forms;

    namespace MyForm {
    public class CreatedForm : System.Windows.Forms.Form
    {
    private string createdObject3;
    private string createdObject2;
    private string createdObject1;
    private string createdObject0;
    private System.Windows.Forms.ComboBox comboBox;
    private System.Windows.Forms.Label label;
    public CreatedForm()
    {
    InitializeComponents();
    }

    void InitializeComponents() {
    //
    // Set up generated class form
    //
    this.SuspendLayout();
    this.Name = "form";
    this.Size = new System.Drawing.Size(776, 300);

    //
    // Set up member label
    //
    label = new System.Windows.Forms.Label();
    label.Name = "label";
    label.Text = "Scegli il linguaggio";
    label.TabIndex = 1;
    label.Location = new System.Drawing.Point(104, 24);
    this.Controls.Add(label);

    //
    // Set up member comboBox
    //
    comboBox = new System.Windows.Forms.ComboBox();
    comboBox.Name = "comboBox";
    comboBox.TabIndex = 0;
    comboBox.Location = new System.Drawing.Point(104, 56);
    comboBox.Size = new System.Drawing.Size(121, 21);
    comboBox.Text = "Scegli";

    //
    // Set up member createdObject0
    //
    createdObject0 = new string();
    comboBox.Items.Add(createdObject0);

    //
    // Set up member createdObject1
    //
    createdObject1 = new string();
    comboBox.Items.Add(createdObject1);

    //
    // Set up member createdObject2
    //
    createdObject2 = new string();
    comboBox.Items.Add(createdObject2);

    //
    // Set up member createdObject3
    //
    createdObject3 = new string();
    comboBox.Items.Add(createdObject3);
    this.Controls.Add(comboBox);
    this.ResumeLayout(false);
    }
    }
    }

    per quale motivo mi segnala 4 errori "Nessun overload del metodo String accetta "0" argomenti
    ???
    ma chi lo sa
    le rgihe dove viene generato l'errore sono queste
    createdObject0 = new string();
    createdObject1 = new string();
    createdObject2 = new string();
    createdObject3 = new string();

  2. #2
    prova cosi
    codice:
     using System; 
    using System.Windows.Forms; 
    
    namespace MyForm { 
    public class CreatedForm : System.Windows.Forms.Form 
    { 
    /*
    *Dichiarale solo una volta
    */
    private string createdObject3; 
    private string createdObject2; 
    private string createdObject1; 
    private string createdObject0; 
    	
    private System.Windows.Forms.ComboBox comboBox; 
    private System.Windows.Forms.Label label; 
    public CreatedForm() 
    { 
    InitializeComponents(); 
    } 
    
    void InitializeComponents() { 
    // 
    // Set up generated class form 
    // 
    this.SuspendLayout(); 
    this.Name = "form"; 
    this.Size = new System.Drawing.Size(776, 300); 
    
    // 
    // Set up member label 
    // 
    label = new System.Windows.Forms.Label(); 
    label.Name = "label"; 
    label.Text = "Scegli il linguaggio"; 
    label.TabIndex = 1; 
    label.Location = new System.Drawing.Point(104, 24); 
    this.Controls.Add(label); 
    
    // 
    // Set up member comboBox 
    // 
    comboBox = new System.Windows.Forms.ComboBox(); 
    comboBox.Name = "comboBox"; 
    comboBox.TabIndex = 0; 
    comboBox.Location = new System.Drawing.Point(104, 56); 
    comboBox.Size = new System.Drawing.Size(121, 21); 
    comboBox.Text = "Scegli"; 
    
    // 
    // Set up member createdObject0 
    // 
    comboBox.Items.Add(createdObject0); 
    
    // 
    // Set up member createdObject1 
    // 
    comboBox.Items.Add(createdObject1); 
    
    // 
    // Set up member createdObject2 
    // 
    comboBox.Items.Add(createdObject2); 
    
    // 
    // Set up member createdObject3 
    // 
    comboBox.Items.Add(createdObject3); 
    this.Controls.Add(comboBox); 
    this.ResumeLayout(false); 
    } 
    }
    L'errore stava nel definire 2 volte le string (new string non new string() )


    Ciao:gren:
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  3. #3
    non va ora mi dice che manca un punto di ingresso ed effettivamente manca il Main() ma io cosa ci devo scrivere nel main di un'applicazione basata sui form?

  4. #4
    ho provato ad inserire un Main come questo
    class Studio
    {
    public static void Main()
    {
    MyForm.CreatedForm mioForm = new MyForm.CreatedForm();
    Application.Run(mioForm);
    }
    }
    ma il problema è nelle prime righe queste qui:
    private string createdObject3;
    private string createdObject2;
    private string createdObject1;
    private string createdObject0;

    dice "Impossibile assegnare un valore diverso al campo "myForm.CreatedForm.createdObject0". Il valore predefinito è null.
    che fare?

  5. #5
    settando a null le quattro variabili dichiarate private parte il prompt di dos ma mi segnala un errore e non mi fa vedere il form

  6. #6
    perfetto funziona stupidamente bastava mettere le stringhe valide al posto di null o di niente!
    grazie 1000 per l'aiuto

  7. #7
    Di nulla ............. se hai problemi ................ sono qui
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  8. #8
    eccomi di nuovo qui ma per quale motivo adesso sono tornato alla modalità design e non vedo più i componenti ?
    inoltre ho posizionato un pulsante ma non me lo visualizza nel codice
    perchè?
    p.s. : uso sharpDevelop

  9. #9
    Originariamente inviato da curiosoC#C#
    eccomi di nuovo qui ma per quale motivo adesso sono tornato alla modalità design e non vedo più i componenti ?
    inoltre ho posizionato un pulsante ma non me lo visualizza nel codice
    perchè?
    p.s. : uso sharpDevelop

    mi sa che è un bug!
    posto uno shot:gren:
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  10. #10
    cmq prova a compilarlo cosi

    csc /target:winexe Studio.cs

    cosi nn ti compare la finestra di dos:quote:
    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.