Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro Substitution in C#
Message
De
05/10/2005 07:53:43
Chrita Lee
ProMOS Technology Inc.
Hsinchu, Taiwan
 
 
À
30/09/2005 05:32:27
Vassilis Aggelakos
Themelio Software (Galatas Panayiotis)
Athens, Grèce
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01054795
Message ID:
01056197
Vues:
25
This message has been marked as a message which has helped to the initial question of the thread.
>1. In C# (VS 2003) Is possible to execute a method for a control when we have its name in a variable ?
> In my VFP framework I do this:
> IF VARTYPE(thisform.cfrmpanel)="C" then
> lcObjectName = "thisform." + thisform.cFrmPanel
> EVALUATE(lcObjectName + ".OnBeforeClose()")
> ENDIF
>
> Is it possible with C# ?

Yes, but it takes great amounts of codes, please refer to:

http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm

>
>2. Is possible to add a variable class control in a form like this ?
>
> lcPanelName = "myXpanel"
> thisform.AddObject(lcPanelName,lcPanelName)
>

Sure. Try something like this(maybe not exact but it's right in concept):

dim x as assembly = system.reflection.assembly.loadwithpartialname("system.web")
dim y as object = x.CreateInstance("System.Web.UI.WebControls.TextBox")
me.controls.add(y)


>3. Is there a With Statement (or equivalent) in C# ?
>
> lcObjectName = "thisform." + lcPanelName
> IF VARTYPE(lcObjectName)="O" THEN
> WITH &lcObjectName
> .top = this.xpanel_guide1.Top
> .left = this.xpanel_guide1.Left
> .width = this.xpanel_guide1.Width
> ENDWITH
> ENDIF
>
>Thanks in Advance
>Vassilis Aggelakos

dim x as new textbox
with x
.text = "Hi"
.font.name = "Arial"
...
end with
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform