English 中文(简体)
C# to VB. 净子转换
原标题:C# to VB.Net Syntax conversion
  • 时间:2009-12-16 18:13:51
  •  标签:
  • vb.net

任何人都能够将以下的辛迪加转换成 v网。

m_TextBox.Loaded += TextBoxLoaded
m_TextBox.Loaded -= TextBoxLoaded;
private void TextBoxLoaded(object sender, RoutedEventArgs e)
 {
   Init();
 }

..
containsTextProp.AddValueChanged(m_TextBox, (sender, args) => UpdateAdorner());
...
private void UpdateAdorner()
        {...}
最佳回答

尽管接受率为25%,但这里是:

AddHandler m_TextBox.Loaded, AddressOf TextBoxLoaded
RemoveHandler m_TextBox.Loaded, AddressOf TextBoxLoaded

Private Sub TextBoxLoaded(ByVal sender as Object, ByVal e as RoutedEventArgs)
    Init()
End Sub

如VB所示,请打电话到<代码>AddValueChanged可直接翻译。 NET s lambda expression support is not as well as C# s. 特别是,VB。 NET lambdas必须是一种表述,因此,你必须交回价值,或打上。 如果是的话,请打电话Sub,在VB中允许。 NET。 您应考虑将<代码>UpdateAdorner的签名改为标准活动手稿(如TextBoxLod 和通过AddressOf UpdateAdoernerAddValueChanged

与此类似:

containsTextProp.AddValueChanged(m_TextBox, AddressOf UpdateAdorner);

...

Private Sub UpdateAdorner(ByVal sender as Object, ByVal e as EventArgs)
    ... 
End Sub
问题回答

你们能够用自己的手套,建设起来,然后打开 app。 NET反射器。 。 NET反射器可以将IL和“带入”C#/VB。 NET等。





相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签