C# to VB.NET

T

Thorsten Adams

Hello newsgrouplers!

In C# there is a code

EControl window = ControlDeclarationManager.Instance.CreateControl(
"Gui\\MessageBoxWindow.gui" );
Controls.Add( window );

window.Controls[ "MessageText" ].Text = messageText;

window.Text = caption;

if( clickHandler != null )
( (EButton)window.Controls[ "OK" ] ).Click += clickHandler;
-----
I tried to convert it to VB.NET as:

Dim window As EControl =
ControlDeclarationManager.Instance.CreateControl("Gui\MessageBoxWindow.gui")
Controls.Add(window)

window.Controls("MessageText").Text = messageText

window.Text = caption

If clickHandler IsNot Nothing Then
DirectCast(window.Controls("OK"), EButton).Click +=
clickHandler
End If

----

But DirectCast is not working because the IDE claims that +=
clickHandler was an event and that I should use RaiseEvent, but I don't
think that's the right way to go.
Can somebody help me?
Thank you very much!
Thorsten Adams
 
S

Stephany Young

Dim window As EControl =
ControlDeclarationManager.Instance.CreateControl("Gui\MessageBoxWindow.gui")

Controls.Add(window)

window.Controls("MessageText").Text = messageText

window.Text = caption

AddHandler DirectCast(window.Controls("OK"), EButton).Click, AddressOf
clickHandler
 

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

Top