By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

Machine???

P: n/a
I have some code from C# that I have converted to vb.net. I used a
converter for a lot of it. One piece is giving problems
Machine.Shift.Right

it says that it is not declared.

where is the machine class, or how else do I do this .

C# code:

public string MaskToLogicalPaths(int aMask)

{

int lMask = aMask;

int lValue = 0;

StringBuilder lReturn = new StringBuilder(128);

try

{

lReturn = new StringBuilder(128);

if(aMask>0)

{

for (;lMask!=0;lMask>>=1)

{

if ((lMask & 1)!=0)

{

lReturn.Append((char)(65+lValue));

lReturn.Append(":,");

}

lValue ++;

}

lReturn.Remove(lReturn.Length-1,1);

}

return lReturn.ToString();

}

finally

{

lReturn = null;

}

}

vb code:

Public Function MaskToLogicalPaths(ByVal aMask As Integer) As String

Dim lMask As Integer = aMask

Dim lValue As Integer = 0

Dim lReturn As New StringBuilder(128)

Try

lReturn = New StringBuilder(128)

If aMask > 0 Then

While lMask <> 0

If (lMask And 1) <> 0 Then

lReturn.Append(Microsoft.VisualBasic.ChrW(65 + lValue))

lReturn.Append(":,")

End If

lValue += 1

lMask = Machine.Shift.Right(lMask, 1)

End While

lReturn.Remove(lReturn.Length - 1, 1)

End If

Return lReturn.ToString()

Finally

lReturn = Nothing

End Try

End Function
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bit shifting is available with the << and >> operators in VB.NET. Look these
up in the help

Regards

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Lespaul36" <le*******@none.net> wrote in message
news:Ol**************@TK2MSFTNGP10.phx.gbl...
I have some code from C# that I have converted to vb.net. I used a
converter for a lot of it. One piece is giving problems
Machine.Shift.Right

it says that it is not declared.

where is the machine class, or how else do I do this .

C# code:

public string MaskToLogicalPaths(int aMask)

{

int lMask = aMask;

int lValue = 0;

StringBuilder lReturn = new StringBuilder(128);

try

{

lReturn = new StringBuilder(128);

if(aMask>0)

{

for (;lMask!=0;lMask>>=1)

{

if ((lMask & 1)!=0)

{

lReturn.Append((char)(65+lValue));

lReturn.Append(":,");

}

lValue ++;

}

lReturn.Remove(lReturn.Length-1,1);

}

return lReturn.ToString();

}

finally

{

lReturn = null;

}

}

vb code:

Public Function MaskToLogicalPaths(ByVal aMask As Integer) As String

Dim lMask As Integer = aMask

Dim lValue As Integer = 0

Dim lReturn As New StringBuilder(128)

Try

lReturn = New StringBuilder(128)

If aMask > 0 Then

While lMask <> 0

If (lMask And 1) <> 0 Then

lReturn.Append(Microsoft.VisualBasic.ChrW(65 + lValue))

lReturn.Append(":,")

End If

lValue += 1

lMask = Machine.Shift.Right(lMask, 1)

End While

lReturn.Remove(lReturn.Length - 1, 1)

End If

Return lReturn.ToString()

Finally

lReturn = Nothing

End Try

End Function

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.