c# to vb .net (2005) help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: c# to vb .net (2005) help

  1. #1
    Join Date
    Dec 2006
    Posts
    30

    c# to vb .net (2005) help

    I want to convert this c# code to vb, please help.

    while (
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    window[++scan] == window[++match] &&
    (scan < strend))
    {
    // Do nothing
    }

    Thanks
    Javfarary

  2. #2
    Join Date
    Jul 2004
    Posts
    81
    There is no simple translation for this in VB. The VB equivalent is quite convoluted.
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  3. #3
    Join Date
    Dec 2006
    Posts
    30
    is it not possible to do the same thing in vb .net?
    guide me.

    Thanks
    Javfarary

  4. #4
    Join Date
    Jul 2004
    Posts
    81
    Yes - it is possible. "alanfo" posted something close to an equivalent on another group.

    But, as I mentioned elsewhere, there are many cases of "assignments within expressions" that cannot be generalized for automatic conversion. There are even some cases that have no possible VB equivalent (I'll try to dig one up for you today).
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  5. #5
    Join Date
    Jul 2004
    Posts
    81
    Here is a working equivalent - you should now see why automatic conversion of assignments within expressions is a bad idea - no one would want to see their code butchered like this by a converter:

    Code:
    Do
       scan = scan + 1
       match = match + 1
       If window(scan) = window (match) Then
          scan = scan + 1 
          match = match + 1 
          If window(scan) = window (match) Then
             scan = scan + 1 
             match = match + 1 
             If window(scan) = window (match) Then
                scan = scan + 1 
                match = match + 1 
                If window(scan) = window (match) Then
                   scan = scan + 1 
                   match = match + 1 
                   If window(scan) = window (match) Then
                      scan = scan + 1 
                      match = match + 1 
                      If window(scan) = window (match) Then
                         scan = scan + 1 
                         match = match + 1 
                         If window(scan) = window (match) Then
                            scan = scan + 1 
                            match = match + 1 
                            If window(scan) = window (match) Then
                               If scan < strend Then
                                  ' Do Nothing 
                               Else
                                  Exit Do
                               End If
                            Else
                               Exit Do
                            End If
                         Else
                            Exit Do
                         End If
                      Else
                         Exit Do
                      End If
                   Else
                      Exit Do
                   End If
                Else
                   Exit Do
                End If
             Else
                Exit Do
             End If
          Else
             Exit Do
          End If
       Else
          Exit Do
       End If
    Loop
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

Similar Threads

  1. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 07:46 AM
  2. Need Books on VS .Net, VB .net, ASP.net
    By Jim Underwood in forum .NET
    Replies: 3
    Last Post: 02-28-2002, 10:45 PM
  3. More on Visual J#.Net
    By Jim Pragit in forum .NET
    Replies: 64
    Last Post: 10-20-2001, 09:06 PM
  4. A moderate view.
    By Paul Mc in forum .NET
    Replies: 214
    Last Post: 06-01-2001, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center