converting VB6 to vb.net

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

    #1

    converting VB6 to vb.net

    for some reason I can not get this to work.. but there is something
    different about it...
    OffSet in both peices = 4812
    VB 6 CODE:
    Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
    ShiftCode = Mid$(Sch, (OffSet Mod 28) + 1, 1)

    this function returns RYDK which is correct..

    VB.Net 2005 Code:
    Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"

    Return Sch.Substring(( OffSet Mod 28) + 1, 1)

    returns SZEL

    Why is there a differance? what am i missing?




  • Stephany Young

    #2
    Re: converting VB6 to vb.net

    The index (first parameter) for the String.SubStrin g() method is zero based,
    so it should be:

    Return Sch.Substring(O ffSet Mod 28, 1)


    "Brian" <bsgallatin@com munity.nospamwr ote in message
    news:Ow5DOytkIH A.4120@TK2MSFTN GP06.phx.gbl...
    for some reason I can not get this to work.. but there is something
    different about it...
    OffSet in both peices = 4812
    VB 6 CODE:
    Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
    ShiftCode = Mid$(Sch, (OffSet Mod 28) + 1, 1)
    >
    this function returns RYDK which is correct..
    >
    VB.Net 2005 Code:
    Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
    >
    Return Sch.Substring(( OffSet Mod 28) + 1, 1)
    >
    returns SZEL
    >
    Why is there a differance? what am i missing?
    >
    >
    >
    >

    Comment

    • Bill McCarthy

      #3
      Re: converting VB6 to vb.net


      "Brian" <bsgallatin@com munity.nospamwr ote in message
      news:Ow5DOytkIH A.4120@TK2MSFTN GP06.phx.gbl...
      for some reason I can not get this to work.. but there is something
      different about it...
      OffSet in both peices = 4812
      VB 6 CODE:
      Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
      ShiftCode = Mid$(Sch, (OffSet Mod 28) + 1, 1)
      >
      this function returns RYDK which is correct..
      >


      Really ? Here it returns Y which is what I would expect.

      VB.Net 2005 Code:
      Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
      >
      Return Sch.Substring(( OffSet Mod 28) + 1, 1)
      >
      returns SZEL
      >
      Why is there a differance? what am i missing?
      >
      Well considering both Mid and SubString with the last parameter as 1 only
      return a single character, I'd say you are missing code that does as you
      described in either VB6 or Vb.NEt ;)

      Comment

      • Brian

        #4
        Re: converting VB6 to vb.net

        That seems to be it.. thanks

        "Stephany Young" <noone@localhos twrote in message
        news:eLWzu%23tk IHA.1368@TK2MSF TNGP02.phx.gbl. ..
        The index (first parameter) for the String.SubStrin g() method is zero
        based, so it should be:
        >
        Return Sch.Substring(O ffSet Mod 28, 1)
        >
        >
        "Brian" <bsgallatin@com munity.nospamwr ote in message
        news:Ow5DOytkIH A.4120@TK2MSFTN GP06.phx.gbl...
        >for some reason I can not get this to work.. but there is something
        >different about it...
        >OffSet in both peices = 4812
        >VB 6 CODE:
        >Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
        > ShiftCode = Mid$(Sch, (OffSet Mod 28) + 1, 1)
        >>
        >this function returns RYDK which is correct..
        >>
        >VB.Net 2005 Code:
        >Const Sch As String = "ABCDEFGHIJKLMN OPQRSTUVWXYZab"
        >>
        >Return Sch.Substring(( OffSet Mod 28) + 1, 1)
        >>
        >returns SZEL
        >>
        >Why is there a differance? what am i missing?
        >>
        >>
        >>
        >>
        >

        Comment

        Working...