Execute Sub with different names

  • Thread starter Thread starter Jovo Mirkovic
  • Start date Start date
J

Jovo Mirkovic

I have a simple Form with a Button1 and TextBox1.
When I click button, I want execute a Sub procedure with name
TextBox1.Text...

Is it possible?

Thanks,
Jovo
 
Jovo Mirkovic said:
I have a simple Form with a Button1 and TextBox1.
When I click button, I want execute a Sub procedure with name
TextBox1.Text...

A method's name must not contain a period (".").
 
A method's name must not contain a period (".").

Yes, I know that...

TextBox1.Text = "SubName"

Call TextBox1.Text ... ? (something like this...?)
 
Jovo Mirkovic said:
Yes, I know that...

TextBox1.Text = "SubName"

This code sets a property.
Call TextBox1.Text ... ? (something like this...?)

This would work if there was a 'Text' method defined in 'TextBox1'.
 
This would work if there was a 'Text' method defined in 'TextBox1'.

I have a code:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = "Test"
Call TextBox1.Text
End Sub

Private Sub Test()
MsgBox ("Hi")
end Sub

I need a "Hi" on the screen when I press Button1...
 
I found solution... :)

CallByName(Me, TextBox1.Text, vbMethod, txtParam.Text)
 
Jovo Mirkovic said:
I have a code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = "Test"
Call TextBox1.Text

Replace the line above with 'Test()'.
 
Thanks to all,
CallByName workin fine (it is an excellent function :))

Jovo
 
You can use reflection - see the methodinfo class.
A bit simpler alternative, is the method CallByName - you'll need an object to make the call, though:

'Sample:
Module Module1

Sub Main()
Dim c As New c1
CallByName(c, "foo", CallType.Method)
End Sub

Class c1
Sub foo()
MsgBox("hei!")
End Sub
End Class

End Module

--------------------
From: Jovo Mirkovic <[email protected]>
References: <[email protected]>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: Re: Execute Sub with different names
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Fri, 05 Nov 2004 09:52:35 -0800
NNTP-Posting-Host: 67.41.129.85
Lines: 1
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:240763
X-Tomcat-NG: microsoft.public.dotnet.languages.vb




Yes, I know that...

TextBox1.Text = "SubName"

Call TextBox1.Text ... ? (something like this...?)

Sorry I don't take feature request for WinRes: it belongs to the .NET Framework SDK. I'm a consumer of WinRes, just like you...
--------------------
From: Thomas Adams <[email protected]>
Newsgroups: microsoft.public.dotnet.internationalization
Subject: RE: How to launch WinRes in full screen mode by another program?
Date: 29 Sep 2004 19:31:46 GMT
Organization: DFN.CIS Senior Customer
Lines: 17
Message-ID: <[email protected]>
References: <[email protected]> <[email protected]>
X-Trace: news.uni-berlin.de cGk7xWd2iWxkO9HVbF7isQODBzMeOPRUidb0ZHc/H3nGY=
User-Agent: Xnews/06.08.25
X-Converter: MorVer Version 1.0.305
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu- berlin.de!uni-berlin.de!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.internationalization:947
X-Tomcat-NG: microsoft.public.dotnet.internationalization

Hi

Your assumption is correct. I did not want to call out its long name
since I didn't know if that could be regarded as breach of NDA. :)

Thanks for the explanation. Do you take feature requests for WinRes?
I'd like to see a "remember last size and location" some day...

~T.

(e-mail address removed) (Xu Yang[MSFT]) wrote:

I'm afraid that LocStudio (when you say LS, I assume you are using LocStudio) does not have the option, and WinRes does not remember its size and
location when it was shut down.
If you are trying to call it in your own application, you can always use ProcessWindowStyle.Maximized when you start the process.

--------------------
From: Thomas Adams <[email protected]>
Newsgroups: microsoft.public.dotnet.internationalization
Subject: How to launch WinRes in full screen mode by another program?
Date: 11 Sep 2004 21:26:17 GMT
Organization: DFN.CIS Senior Customer
Lines: 9
Message-ID: <[email protected]>
X-Trace: news.uni-berlin.de 9sj2ViefNkwlw4tmA89WfA6mie8fmrCfbXqlIJqRehUb0=
User-Agent: Xnews/06.08.25
X-Face: #Rk@TOQ|^!ZG|&z6lA@-CY>/xB[Ei1mG*&S.+A5z;Ng?3OxX[#DVZw!"o!c`S|p:(zsX-EkdZZ(IVnFRTX%!:Sv^L&Gk~s]vJ@Z~%Rm@G]fr*r2P}u5 *&k/-_2+&Qowj6hiJ1b$^JQf:uy9456HIdKq*B`NC##kyO,>7"Ztnav+=71b*"E+DIme;{i&)ii{#6e?i8P,1Xpc[q0}i:Tm];B1
X-Converter: MorVer Version 1.0.305
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu- berlin.de!uni-berlin.de!not-for-mail
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.internationalization:902
X-Tomcat-NG: microsoft.public.dotnet.internationalization

Hi

Let's imagine you're using a translation environment (LS) that's
launching WinRes every now and then. Is it possible to open WinRes in
full screen mode in this case? It's quite annoying that it doesn't
remember if I switch it to full screen mode the next time it is invoked.

thanks,
Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top