Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anybody on for translating VFP to C#
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01170530
Message ID:
01170556
Vues:
12
>Hi
>I have a piece of code which programatically makes a few controls
>I want to replicate this in C#
>
>FOR i= 1 TO 20
> lcTxt = 'txt' + STRTRAN(STR(i,2),' ','0')
> WAIT WINDOW lcTxt
> x= lctxt + " = CREATEOBJECT('textbox')"
> &x
>ENDFOR
>
>(This just makes 20 texbox controls txt01, txt02,txt03.....txt20
>
>Thanks in advance
>Gerard
int x = 20;
int y = 50;

for (int i = 0; i < 20; i++)
{
   TextBox txtbox = new System.Windows.Forms.TextBox();
   txtbox.Name = "txt" + i.ToString();
   txtbox.Text = txtbox.Name;
   txtbox.Location = new Point(x, y);

   this.Controls.Add(txtbox);

   y += txtbox.Height + 2;
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform