<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Chiamare una Sub/Function con stringa]]></title><description><![CDATA[<p dir="auto">Esiste qualche calsse in .NET che richiama Sub o Function partendo dal loro nome sotto forma di stringa?</p>
<p dir="auto">Ad esempio:</p>
<pre><code>Sub Ciao()
....
End sub
Dim mySub as String = "ciao"
Call mySub (che ovviamente dovrebbe essere sostituita con qualcosa che funzioni...)
</code></pre>
]]></description><link>https://dev.connect.gt/topic/48659/chiamare-una-sub-function-con-stringa</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 14:33:08 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/48659.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 29 Sep 2007 18:37:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Chiamare una Sub/Function con stringa on Wed, 03 Oct 2007 14:07:32 GMT]]></title><description><![CDATA[<p dir="auto">se adesso qualcuno mi sa dire come far ereditare una classe esterna ad un Control inserito in una pagina, in modo che siano accessibili da essa(classe esterna) anche tutti i WebControl potrei spostare tutto il codice nel mio B.O.<br />
.....<br />
<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/ad0a1f8d-b404-40e4-a46a-e563b14044da-dho.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--arrabbiato" style="height:1.4em;width:auto;vertical-align:middle" title=":x" alt="" /></p>
<p dir="auto">era un altro mio post...<br />
:D:D faccio anche cross-posting....</p>
]]></description><link>https://dev.connect.gt/post/609595</link><guid isPermaLink="true">https://dev.connect.gt/post/609595</guid><dc:creator><![CDATA[hwlab123]]></dc:creator><pubDate>Wed, 03 Oct 2007 14:07:32 GMT</pubDate></item><item><title><![CDATA[Reply to Chiamare una Sub/Function con stringa on Wed, 03 Oct 2007 14:02:17 GMT]]></title><description><![CDATA[<p dir="auto">ecco qui<br />
Mi serve per un menù XML in cui metto anche eventuali chiamate sull'action dei pulsanti scrivendo as esempio sub:miasub oppure redirect:link.aspx oppure transfer:link.aspx con opportuni argomenti per chiamata.<br />
Quindi poi dovevo invocare 'ste chiamate....</p>
<pre><code>[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] CallFromString([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] _subs [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]Optional[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] _args() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE][SIZE=2])[/SIZE]
 
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] MioAmbito [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Type = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].GetType()[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] MioMetodo [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Reflection.MethodInfo = MioAmbito.GetMethod(_subs)[/SIZE]
 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] IsNothing(MioMetodo) [/SIZE][SIZE=2][COLOR=#0000ff]Then [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Exit[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[COLOR=#0000ff]' a me serviva questa riga qua sotto , perchè faccio il casting [/COLOR]
[COLOR=#0000ff]' di una stringa separata da ; in array e se passo nulla [/COLOR]
[COLOR=#0000ff]'mi crea _args() uguale a args(0)=""[/COLOR]
[COLOR=#0000ff]'...però si può fare meglio[/COLOR]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] _args.Length = 1 [/SIZE][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][SIZE=2] _args(0) = [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] _args = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] IsNothing(_args) [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]'invoco senza argomenti[/COLOR][/SIZE]
[SIZE=2]MioMetodo.Invoke([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]'invoco con argomenti[/COLOR][/SIZE]
[SIZE=2]MioMetodo.Invoke([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2], _args)[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
</code></pre>
<p dir="auto">questa riga</p>
<pre><code>[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] MioAmbito [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Type = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].GetType()[/SIZE]
</code></pre>
<p dir="auto">potrebbe anche essere</p>
<pre><code>[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] MioAmbito [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Type = [/SIZE][SIZE=2][COLOR=#0000ff]Page[/COLOR][/SIZE][SIZE=2].GetType()[/SIZE]
</code></pre>
<p dir="auto">Ma io lo utilizzo in un control, non nel Code-behind della pagina o nella pagina stessa, quindi ho dovuto fare così.<br />
Penso sia giusto...funziona...</p>
]]></description><link>https://dev.connect.gt/post/609594</link><guid isPermaLink="true">https://dev.connect.gt/post/609594</guid><dc:creator><![CDATA[hwlab123]]></dc:creator><pubDate>Wed, 03 Oct 2007 14:02:17 GMT</pubDate></item><item><title><![CDATA[Reply to Chiamare una Sub/Function con stringa on Wed, 03 Oct 2007 13:34:43 GMT]]></title><description><![CDATA[<p dir="auto">dai, postala che può essere molto utile a tutti <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=bb61372b9dc" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
<p dir="auto"><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/54a3bffb-5e4a-4eb8-81dc-99b2072e5d05-175.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--ciauz" style="height:1.4em;width:auto;vertical-align:middle" title=":ciauz:" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/609592</link><guid isPermaLink="true">https://dev.connect.gt/post/609592</guid><dc:creator><![CDATA[legolas]]></dc:creator><pubDate>Wed, 03 Oct 2007 13:34:43 GMT</pubDate></item><item><title><![CDATA[Reply to Chiamare una Sub/Function con stringa on Wed, 03 Oct 2007 11:04:57 GMT]]></title><description><![CDATA[<p dir="auto">Si usa la System.Reflection per esplorare il codice nell'assembly (minchia che figata!!!!)</p>
<p dir="auto">Se serve a qualcuno posto la soluzione.;)</p>
]]></description><link>https://dev.connect.gt/post/609593</link><guid isPermaLink="true">https://dev.connect.gt/post/609593</guid><dc:creator><![CDATA[hwlab123]]></dc:creator><pubDate>Wed, 03 Oct 2007 11:04:57 GMT</pubDate></item></channel></rss>