Precedente :: Successivo |
Autore |
Messaggio |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 04 Feb 2009 18:38 Oggetto: [Visul C# 2008] Piccola domanda e dichiarazione inputBox |
|
|
Salve utenti.
Sto studianto il C#, uso come editor visual C# 2008, e per questo vi vorei fare una piccola domanda:
L'editor visual C# 2008 è il C#?
Vi faccio questa domanda perche ho impostare un'inputbox, avendo visto la sua dichiarazione su un tutorials on-line, nella mia applicazione, è restituendo un errore di sintassi sulla inputbox vorrei sapere come dichiararla all'interno del codice del programma.
P.S. : Finalmente sto studianto il C#. |
|
Top |
|
 |
bdoriano Amministratore


Registrato: 02/04/07 12:05 Messaggi: 14391 Residenza: 3° pianeta del sistema solare...
|
Inviato: 04 Feb 2009 21:50 Oggetto: |
|
|
Ciao sevenjeak,
ehm... non ho capito la domanda...
PS: io sto studiando il C# applicato alle pagine asp.net...  |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 04 Feb 2009 22:09 Oggetto: |
|
|
Cosa significa la domanda?
Se intendi Visual C# Express è l'IDE C# free poi c'è quello a pagamento integrato in Visual Studio,ma comunque sono tutti e due editor C#.
Prova a scaricare Visual C# Express,Visual studio non costa un po' tantino?
Citazione: | io sto studiando il C# applicato alle pagine asp.net. |
Allora ogni tanto sarebbe bello vederti in questa sezione.
 |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 05 Feb 2009 16:12 Oggetto: |
|
|
mdweb ha scritto: |
Allora ogni tanto sarebbe bello vederti in questa sezione.
|
Infatti, un pò di regore di sintassi li so dai linguaggi per internet, sopratutto in questo periodo postero + in questa lezione visto che sto studianto gratuitamente il C# e il java.
Cmq volevo sapere se il Visual C# 2008 è un editor per il C#?
Vi faccio questa domanda perche su internet ho visto come inizializare una variabile da una inputbox, ma il problema, e che quando inserisco il codice per dichiarare l'inputbox l'edito mi da errore, mi dice che non mi riconosce la sua sintassi.
Quindi vorrei sapere se l'editor che uso è per il C# o sbaglio quanlcosa nel dichiarare la input box? |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 05 Feb 2009 16:28 Oggetto: |
|
|
Io non scono Visual C# 2008.Conosco solo Visual C# Express o Visual Studio. |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 05 Feb 2009 17:02 Oggetto: |
|
|
Io non saprei che visual C# 2008 e il linguaggio C# ma so che fa parte di visual studio 2008 (ma apparte dal pacchetto), in questo caso è il C#? |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 06 Feb 2009 21:36 Oggetto: |
|
|
sevenjeak ha scritto: | Io non saprei che visual C# 2008 e il linguaggio C# ma so che fa parte di visual studio 2008 (ma apparte dal pacchetto), in questo caso è il C#? |
da quel poco che è capito si!
Il mio consiglio è di installare la versione Expression che è free |
|
Top |
|
 |
bdoriano Amministratore


Registrato: 02/04/07 12:05 Messaggi: 14391 Residenza: 3° pianeta del sistema solare...
|
Inviato: 07 Feb 2009 12:47 Oggetto: |
|
|
sevenjeak ha scritto: | Cmq volevo sapere se il Visual C# 2008 è un editor per il C#? |
Si.
sevenjeak ha scritto: | Vi faccio questa domanda perche su internet ho visto come inizializare una variabile da una inputbox, ma il problema, e che quando inserisco il codice per dichiarare l'inputbox l'edito mi da errore, mi dice che non mi riconosce la sua sintassi.
Quindi vorrei sapere se l'editor che uso è per il C# o sbaglio quanlcosa nel dichiarare la input box? |
Posta il codice incriminato e verifichiamo, ok?
@mdweb:
Se ha la versione professional, perché dovrebbe passare alla Express?
 |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 07 Feb 2009 14:42 Oggetto: |
|
|
Citazione: | Se ha la versione professional, perché dovrebbe passare alla Express? |
Non riuscivo a capire quale versione avesse |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 07 Feb 2009 17:47 Oggetto: |
|
|
Infatti io mi sa che non ho la versione professionare, ho scaricato direttamente il file ISO di visual studio 2008 dal sito, ma non so, è proprio per questo che non mi permette di installare tutto il pachetto e mi dice se voglio instalalre solo visual basic o altri linguaggi? |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 07 Feb 2009 22:23 Oggetto: |
|
|
la ISO è il file di Visual Studio.
Hai scaricato la versione trial? |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 07 Feb 2009 22:40 Oggetto: |
|
|
No, nn è la versione trial, ho notato solamente ora che è il file ISO della versione express, ma come ho detto mi permette di dicidere l'editor da installare senza installare automaticamente tutti gli editor di visual studio, come mai? |
|
Top |
|
 |
bdoriano Amministratore


Registrato: 02/04/07 12:05 Messaggi: 14391 Residenza: 3° pianeta del sistema solare...
|
Inviato: 08 Feb 2009 13:58 Oggetto: |
|
|
Hai scaricato questo?
Comunque, posta il codice che stai usando. |
|
Top |
|
 |
bdoriano Amministratore


Registrato: 02/04/07 12:05 Messaggi: 14391 Residenza: 3° pianeta del sistema solare...
|
Inviato: 08 Feb 2009 14:31 Oggetto: |
|
|
Dunque, a quanto ho capito, InputBox è tipico di VisualBasic.
Ho trovato questo codice (non so se funziona) di David Piepgrass:
Codice: | using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
namespace System.Windows.Forms
{
///
/// This static class contains methods named Show() to display a dialog box
/// with an input field, similar in appearance to the one in Visual Basic.
/// The Show() method returns null if the user clicks Cancel, and non-null
/// if the user clicks OK.
///
public class InputBox
{
static public string Show(string Prompt)
{ return Show(Prompt, null, null, int.MinValue, int.MinValue); }
static public string Show(string Prompt, string Title, string Default)
{ return Show(Prompt, Title, Default, int.MinValue, int.MinValue); }
static public string Show(string Prompt, string Title, string Default, int xPos, int yPos)
{
if (Title == null)
Title = Application.ProductName;
InputBoxDialog dlg = new InputBoxDialog(Prompt, Title, xPos, yPos);
if (Default != null)
dlg.txtInput.Text = Default;
DialogResult result = dlg.ShowDialog();
if (result == DialogResult.Cancel)
return null;
else
return dlg.txtInput.Text;
}
}
internal class InputBoxDialog : Form
{
private System.Windows.Forms.Label lblPrompt;
public System.Windows.Forms.TextBox txtInput;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
public InputBoxDialog(string prompt, string title) : this(prompt, title, int.MinValue, int.MinValue) {}
public InputBoxDialog(string prompt, string title, int xPos, int yPos)
{
if (xPos != int.MinValue && yPos != int.MinValue) {
this.StartPosition = FormStartPosition.Manual;
this.Location = new System.Drawing.Point(xPos, yPos);
}
InitializeComponent();
lblPrompt.Text = prompt;
this.Text = title;
Graphics g = this.CreateGraphics();
SizeF size = g.MeasureString(prompt, lblPrompt.Font, lblPrompt.Width);
Debug.WriteLine("PROMPT SIZE: " + size);
if (size.Height > lblPrompt.Height)
this.Height += (int)size.Height - lblPrompt.Height;
txtInput.SelectionStart = 0;
txtInput.SelectionLength = txtInput.Text.Length;
txtInput.Focus();
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.lblPrompt = new System.Windows.Forms.Label();
this.txtInput = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblPrompt
//
this.lblPrompt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.lblPrompt.BackColor = System.Drawing.SystemColors.Control;
this.lblPrompt.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblPrompt.Location = new System.Drawing.Point(12, 9);
this.lblPrompt.Name = "lblPrompt";
this.lblPrompt.Size = new System.Drawing.Size(302, 71);
this.lblPrompt.TabIndex = 3;
//
// txtInput
//
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.txtInput.Location = new System.Drawing.Point(8, 88);
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(381, 20);
this.txtInput.TabIndex = 0;
this.txtInput.Text = "";
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(326, 8);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(64, 24);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "&OK";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(326, 40);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(64, 24);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "&Cancel";
//
// InputBoxDialog
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(398, 117);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.lblPrompt);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputBoxDialog";
this.ResumeLayout(false);
}
#endregion
}
} |
|
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 09 Feb 2009 18:48 Oggetto: |
|
|
Ho provato il codice ma non va, cmq infatti io il comando inputbox lo prendo da visualbasie con questo codice trovato su internet:
Codice: |
Microsoft.VisualBasic.[b]Interaction[/b].InputBox(Prompt, Title, Default, XPos, YPos);
|
Ma non funziona, mi da errore nella parte indicata in grazzetto nel codice.
bdoriano ha scritto: | scaricato questo? |
Si, è proprio quello che ho io.
P.S. : alla fine mi sa neanche utiliziamo Visual C# come editor per imparare il C |
|
Top |
|
 |
bdoriano Amministratore


Registrato: 02/04/07 12:05 Messaggi: 14391 Residenza: 3° pianeta del sistema solare...
|
Inviato: 12 Feb 2009 23:04 Oggetto: |
|
|
Visual C# è l'editor per C#.
La versione Express ha, ovviamente, delle limitazioni.
Probabilmente non ti consente di accedere direttamente alle librerie di Visual Basic.
Ho trovato quest'altra pagina:
Codice: | using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace DocuTrackProSE
{
/// <summary>
/// Summary description for InputBox.
///
public class InputBoxDialog : System.Windows.Forms.Form
{
#region Windows Contols and Constructor
private System.Windows.Forms.Label lblPrompt;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox txtInput;
/// <summary>
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public InputBoxDialog()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
#endregion
#region Dispose
/// <summary>
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.lblPrompt = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.txtInput = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// lblPrompt
//
this.lblPrompt.Anchor =
((System.Windows.Forms.AnchorStyles)
((((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblPrompt.BackColor = System.Drawing.SystemColors.Control;
this.lblPrompt.Font =
new System.Drawing.Font("Microsoft Sans Serif", 9.75F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.lblPrompt.Location = new System.Drawing.Point(12, 9);
this.lblPrompt.Name = "lblPrompt";
this.lblPrompt.Size = new System.Drawing.Size(302, 82);
this.lblPrompt.TabIndex = 3;
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnOK.Location = new System.Drawing.Point(326, 24);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(64, 24);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "&OK";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.Location = new System.Drawing.Point(326, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 24);
this.button1.TabIndex = 2;
this.button1.Text = "&Cancel";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// txtInput
//
this.txtInput.Location = new System.Drawing.Point(8, 100);
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(379, 20);
this.txtInput.TabIndex = 0;
this.txtInput.Text = "";
//
// InputBoxDialog
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(398, 128);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.lblPrompt);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputBoxDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "InputBox";
this.Load += new System.EventHandler(this.InputBox_Load);
this.ResumeLayout(false);
}
#endregion
#region Private Variables
string formCaption = string.Empty;
string formPrompt = string.Empty;
string inputResponse = string.Empty;
string defaultValue = string.Empty;
#endregion
#region Public Properties
public string FormCaption
{
get{return formCaption;}
set{formCaption = value;}
} // property FormCaption
public string FormPrompt
{
get{return formPrompt;}
set{formPrompt = value;}
} // property FormPrompt
public string InputResponse
{
get{return inputResponse;}
set{inputResponse = value;}
} // property InputResponse
public string DefaultValue
{
get{return defaultValue;}
set{defaultValue = value;}
} // property DefaultValue
#endregion
#region Form and Control Events
private void InputBox_Load(object sender, System.EventArgs e)
{
this.txtInput.Text=defaultValue;
this.lblPrompt.Text=formPrompt;
this.Text=formCaption;
this.txtInput.SelectionStart=0;
this.txtInput.SelectionLength=this.txtInput.Text.Length;
this.txtInput.Focus();
}
private void btnOK_Click(object sender, System.EventArgs e)
{
InputResponse = this.txtInput.Text;
this.Close();
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
#endregion
}
} |
|
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 13 Feb 2009 17:39 Oggetto: |
|
|
Non lo ancora provato, perche non ho tempo ed ho cambiato da pochi giorni editor visto che non rispondeva nussuno, cmq ora se ho tempo reinstallo l'editor e ti faccio sapere. |
|
Top |
|
 |
|