Home > other >  Problem converting C# programming language to vb .net
Problem converting C# programming language to vb .net

Time:06-19

I have a piece of code in C # that I converted to Visual Basic, but unfortunately I can not convert part of this code to Visual Basic and I have not been able to do so even using online converters. I have an event that I had trouble to call it. my code is:

Private Sub TextBoxListViewTextTextChanged(sender As Object, e As EventArgs)
        If _subtitleListViewIndex >= 0 Then
            Dim numberOfNewLines As Integer = textBoxListViewText.Text.Length - textBoxListViewText.Text.Replace(Environment.NewLine, " ").Length
            Utilities.CheckAutoWrap(textBoxListViewText, New KeyEventArgs(Keys.None), numberOfNewLines)
            Dim text As String = textBoxListViewText.Text.TrimEnd()
            _subtitle.Paragraphs(_subtitleListViewIndex).Text = text
            SubtitleListView1.SetText(_subtitleListViewIndex, text)
            _listViewTextUndoIndex = _subtitleListViewIndex
            StartUpdateListSyntaxColoring()
        End If
    End Sub

But here I have a problem because I can not call directly:

Private Sub InitializeListViewEditBox(ByVal p As Paragraph)

        textBoxListViewText.TextChanged -= TextBoxListViewTextTextChanged()
       
End Sub

I have no idea how I can solve this problem.

CodePudding user response:

You should be using:

RemoveHandler textBoxListViewText.TextChanged, AddressOf TextBoxListViewTextTextChanged

and

AddHandler textBoxListViewText.TextChanged, AddressOf TextBoxListViewTextTextChanged
  • Related