473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Pleae assist me to view the code

yxq
Hello,
There are the C# codes£¬but i know a little about C#, i want to convert to
VB.NET, i have try the
url(http://authors.aspalliance.com/aldot...ranslate.aspx), but
the converted codes will not work. Thank you!
char[] Source = new char[15]
int n, hi, low, v;

do
{
low = Source[n]; // I use Microsoft.VisualBasic.Val(Source(n)) in
vb.net
v = hi << 8; // << what meaning?
v |= low; // |= what meaning?

Source[n] = (char)(v % 24); // % is Mod?
Source[n] = (char)(v / 24);
hi =v % 24;
}while((--n) >= 0); // --n>=0 what meaning£¿
Nov 21 '05 #1
4 1165

"yxq" <ga***@163.net> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Hello,
There are the C# codes£¬but i know a little about C#, i want to convert to
VB.NET, i have try the
url(http://authors.aspalliance.com/aldot...ranslate.aspx), but
the converted codes will not work. Thank you!
char[] Source = new char[15]
int n, hi, low, v;

do
{
low = Source[n]; // I use Microsoft.VisualBasic.Val(Source(n)) in
vb.net
v = hi << 8; // << what meaning?
v |= low; // |= what meaning?

Source[n] = (char)(v % 24); // % is Mod?
Source[n] = (char)(v / 24);
hi =v % 24;
}while((--n) >= 0); // --n>=0 what meaning£¿

do

{

low = Source[n]; // I use Microsoft.VisualBasic.Val(Source(n)) in vb.net

v = hi << 8; // << what meaning?

// Shift the bits in variable hi left 8

v |= low; // |= what meaning?

// perform bitwise OR on v and low, assign the result to v

Source[n] = (char)(v % 24); // % is Mod?

// Yes, % is the C# modulus operator

Source[n] = (char)(v / 24);

hi =v % 24;

}while((--n) >= 0); // --n>=0 what meaning£¿

// -- before the operand is the prefix decrement operator.

// If subtracts 1 from n before testing to see if n is >= 0
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 21 '05 #2
On Tue, 9 Nov 2004 21:49:30 +0800, yxq wrote:
v = hi << 8; // << what meaning?
That is the Shift Left operator and it is the same in VB.Net 2003
v |= low; // |= what meaning?
This is the bitwise Or operator. In VB.Net 2003, the code would be

v = v Or low
Source[n] = (char)(v % 24); // % is Mod?
Yes
}while((--n) >= 0); // --n>=0 what meaning£¿


The (--n) means to decrement n BEFORE checking the condition in the while
loop. This is the equivalent VB code:

do

'Other code here

n = n - 1
loop while n >= 0

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #3
YXQ
Thank you, my converted codes are below, but dont work yet!!!!!
************************************
Do
low = Microsoft.VisualBasic.Val(Source(n))
v = hi < 8
v = v Or low
Source(n) = (CChar(CStr(v Mod 24)))
Source(n) = CChar(CStr(v / 24))
hi = v Mod 24
n = n - 1
Loop While n >= 0
******************************************

"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net">
??????:pq*****************************@40tude.net. ..
On Tue, 9 Nov 2004 21:49:30 +0800, yxq wrote:
v = hi << 8; // << what meaning?


That is the Shift Left operator and it is the same in VB.Net 2003
v |= low; // |= what meaning?


This is the bitwise Or operator. In VB.Net 2003, the code would be

v = v Or low
Source[n] = (char)(v % 24); // % is Mod?


Yes
}while((--n) >= 0); // --n>=0 what meaning£¿


The (--n) means to decrement n BEFORE checking the condition in the while
loop. This is the equivalent VB code:

do

'Other code here

n = n - 1
loop while n >= 0

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Nov 21 '05 #4
On Wed, 10 Nov 2004 08:36:15 +0800, YXQ wrote:
Do
low = Microsoft.VisualBasic.Val(Source(n))
I don't think this line is right. You might try CInt(Source(n))
v = hi < 8
I think this should be v = hi << 8
v = v Or low
Source(n) = (CChar(CStr(v Mod 24)))
Source(n) = CChar(CStr(v / 24))
hi = v Mod 24
n = n - 1
Loop While n >= 0
******************************************


What is this code supposed to do?

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jim Langston | last post by:
I understand the rule of three, that if I have a custom constructor, copy or destructor I probably need the other 2. My class object definately has a custom constructor and destructor, but I'm...
1
by: slaterjas | last post by:
We are running DB2 version 8.1.5. When we execute a query within SQL Assist we are only returned 200 rows. Is there a setting that we can change to increase this?? I can get more results if I...
15
by: Daniel Billingsley | last post by:
Speaking of trying to read deeply nested if-else blocks... I often find it's not always easy to tell one indent level from another (granted I keep my tab settings low so I'm not halfway across...
54
by: MLH | last post by:
I use A97 and do not always insert line numbers while writing procedures. I find it necessary to go back and add them later to aid in debugging. Nearly 3 years ago, something was mentioned in...
1
by: Marcin Balcerzak | last post by:
Hi, Not being an expert in Java (JRE 1.5) or Eclipse (3.1.1) I've encountered an intractable problems. Without apparent reason my Eclipse stopped: 1) Providing me content assist (shows "No...
1
by: Chris | last post by:
Hi, I am working on a small which involves a touchscreen and I need to create a on-screen keyboard. I need some assistance with a few questions 1. For the the buttons, do I user their text as...
14
by: donovans | last post by:
Hey there, First question: I really need help with debugging this code. I keep getting the java.sql.SQLException: General error, and am now lost at a solution to it...I get this with about 4 of...
8
by: jasone | last post by:
Hi all, im nearly there with this one and im sure it shouldnt be hard to solve, i just cant seem to find the solution. ive got records being displayed, the user can then tick what records to...
0
by: Frank Swarbrick | last post by:
We're trying to use SQL Assist in the DB2 Control Center for DB2/LUW 9.5 and we are getting the following error: "Routine "SYSIBM.SQLTABLES" (specific name "TABLES") has returned an error SQLSTATE...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.