VB6 to C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mickey Swanson

    #1

    VB6 to C#

    I need some help converting the following to c#.
    I'm new to the dotnet stuff so any help or pointers would be appreciated
    I'm having trouble finding the replacements for InStr and Mid$



    Public Function SQLText(ByVal sData As String) As String



    Dim strTemp As String

    Dim StrTemp2 As String

    Dim intX As Integer

    Dim intY As Integer



    intX = InStr(1, sData, "'")



    If intX > 0 Then

    strTemp = Mid$(sData, 1, intX)

    strTemp = strTemp & "'" & Mid$(sData, intX + 1)



    intY = InStr(intX + 2, strTemp, "'")

    Do Until intY = 0

    StrTemp2 = Mid$(strTemp, 1, intY)

    strTemp = StrTemp2 & "'" & Mid$(strTemp, intY + 1)

    intY = InStr(intY + 2, strTemp, "'")

    Loop

    Else

    strTemp = sData

    End If



    SQLText = "'" & Trim$(strTemp) & "'"



    End Function



    Mickey Swason


  • Jeffrey Tan[MSFT]

    #2
    RE: VB6 to C#


    Hi Mickey,

    I have found that this post has been posted in C# queue. I have replied you
    in C# queue.
    Please follow up there, I will work with you.
    Thanks for your understanding.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    --------------------
    | From: "Mickey Swanson" <swanson@dixi e-net.com>
    | Subject: VB6 to C#
    | Date: Sun, 16 Nov 2003 18:16:43 -0600
    | Lines: 63
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    | Message-ID: <eABDXAKrDHA.25 28@TK2MSFTNGP10 .phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.genera l
    | NNTP-Posting-Host: r166h97.dixie-net.com 64.89.166.97
    | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:115792
    | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    |
    | I need some help converting the following to c#.
    | I'm new to the dotnet stuff so any help or pointers would be appreciated
    | I'm having trouble finding the replacements for InStr and Mid$
    |
    |
    |
    | Public Function SQLText(ByVal sData As String) As String
    |
    |
    |
    | Dim strTemp As String
    |
    | Dim StrTemp2 As String
    |
    | Dim intX As Integer
    |
    | Dim intY As Integer
    |
    |
    |
    | intX = InStr(1, sData, "'")
    |
    |
    |
    | If intX > 0 Then
    |
    | strTemp = Mid$(sData, 1, intX)
    |
    | strTemp = strTemp & "'" & Mid$(sData, intX + 1)
    |
    |
    |
    | intY = InStr(intX + 2, strTemp, "'")
    |
    | Do Until intY = 0
    |
    | StrTemp2 = Mid$(strTemp, 1, intY)
    |
    | strTemp = StrTemp2 & "'" & Mid$(strTemp, intY + 1)
    |
    | intY = InStr(intY + 2, strTemp, "'")
    |
    | Loop
    |
    | Else
    |
    | strTemp = sData
    |
    | End If
    |
    |
    |
    | SQLText = "'" & Trim$(strTemp) & "'"
    |
    |
    |
    | End Function
    |
    |
    |
    | Mickey Swason
    |
    |
    |

    Comment

    • Jeffrey Tan[MSFT]

      #3
      RE: VB6 to C#


      Hi Mickey,

      I have found that this post has been posted in C# queue. I have replied you
      in C# queue.
      Please follow up there, I will work with you.
      Thanks for your understanding.

      Best regards,
      Jeffrey Tan
      Microsoft Online Partner Support
      Get Secure! - www.microsoft.com/security
      This posting is provided "as is" with no warranties and confers no rights.

      --------------------
      | From: "Mickey Swanson" <swanson@dixi e-net.com>
      | Subject: VB6 to C#
      | Date: Sun, 16 Nov 2003 18:16:43 -0600
      | Lines: 63
      | X-Priority: 3
      | X-MSMail-Priority: Normal
      | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
      | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
      | Message-ID: <eABDXAKrDHA.25 28@TK2MSFTNGP10 .phx.gbl>
      | Newsgroups: microsoft.publi c.dotnet.genera l
      | NNTP-Posting-Host: r166h97.dixie-net.com 64.89.166.97
      | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:115792
      | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
      |
      | I need some help converting the following to c#.
      | I'm new to the dotnet stuff so any help or pointers would be appreciated
      | I'm having trouble finding the replacements for InStr and Mid$
      |
      |
      |
      | Public Function SQLText(ByVal sData As String) As String
      |
      |
      |
      | Dim strTemp As String
      |
      | Dim StrTemp2 As String
      |
      | Dim intX As Integer
      |
      | Dim intY As Integer
      |
      |
      |
      | intX = InStr(1, sData, "'")
      |
      |
      |
      | If intX > 0 Then
      |
      | strTemp = Mid$(sData, 1, intX)
      |
      | strTemp = strTemp & "'" & Mid$(sData, intX + 1)
      |
      |
      |
      | intY = InStr(intX + 2, strTemp, "'")
      |
      | Do Until intY = 0
      |
      | StrTemp2 = Mid$(strTemp, 1, intY)
      |
      | strTemp = StrTemp2 & "'" & Mid$(strTemp, intY + 1)
      |
      | intY = InStr(intY + 2, strTemp, "'")
      |
      | Loop
      |
      | Else
      |
      | strTemp = sData
      |
      | End If
      |
      |
      |
      | SQLText = "'" & Trim$(strTemp) & "'"
      |
      |
      |
      | End Function
      |
      |
      |
      | Mickey Swason
      |
      |
      |

      Comment

      Working...