Von VBA in C#



  • Kann mir bitte jemand beim Umformen des Codes von VBA in C# helfen?

    Sub subAuslesen(NodX As node)
    Dim NodItem As node
    
    i = 0
    
        Do Until NodX Is Nothing
                i = i + 1
                m = (i * 10)
                'strPosNummer = funIntPosnummer(Left(NodX, 6))
                subDatenEintragen NodX.Parent.Text, NodX.Text, m
    
                If NodX.Child Is Nothing Then
                Else
                    Set NodItem = NodX.Child
    
                    Do Until NodItem Is Nothing
                        m = m + 1
                        subDatenEintragen NodItem.Parent.Text, NodItem.Text, m
                        Set NodItem = NodItem.Next
                    Loop
                End If
            Set NodX = NodX.Next
        Loop
    
    End Sub
    
    Private Sub subEbeneErstellen()
        Dim rsa As ADODB.Recordset
        Dim strKey, strKeyParent, strText As String
    
        Set cnn = CurrentProject.Connection
        Set rsa = New Recordset
        Set F = Me
    
        strSQL = strSQLBauen(Me.txtBaugruppe)
        rsa.Open strSQL, cnn, adOpenDynamic, adLockReadOnly
    
        Set nod = F.treStueLi.Nodes.Add(, , "a" & Me.txtBaugruppe, Me.txtBaugruppe)
        nod.Expanded = True
        Do Until rsa.EOF
            If Left(rsa!ident, 1) = "5" Then
                m = m + 1
                strKey = "b_" & m & "_" & rsa!ident
                strKeyParent = "a" & Me.txtBaugruppe
                strText = rsa!ident & " " & rsa!Ben1 & " ~ " & rsa!Count
                Set nod = F.treStueLi.Nodes.Add(strKeyParent, tvwChild, strKey, strText)
            End If
            rsa.MoveNext
        Loop
        rsa.Close
        cnn.Close
        Set rsa = Nothing
    End Sub
    

    Auch habe ich ein Problem damit, wie ich folgendes initialisieren soll:

    Dim nod As MSComctlLib.node
    Dim F As Form
    



Anmelden zum Antworten