473,406 Members | 2,549 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,406 software developers and data experts.

Length of String Returning HEX??? Weird

Joe
Hi,
When I get the length of a string I expect to get an integer back. I
getting back &H6 for both intVar1 and intVar2 from the following code:

Dim strVar As String
Dim intVar1 As Integer
Dim intVar2 As Integer

strVar = "foobar"

intVar1 = strVar.Length
intVar2 = CStr(Len(strVar))

Could someone PLEASE tell me what I'm doing wrong???
Thanks

- Joe
Nov 21 '05 #1
3 1466

Check to see if you have "Hexadecimal display" turned on under
Tools->Options->Debugging->General.

Brian Davis
http://www.knowdotnet.com

"Joe" <pr**************@gmail.com> wrote in message
news:fe*************************@posting.google.co m...
Hi,
When I get the length of a string I expect to get an integer back. I
getting back &H6 for both intVar1 and intVar2 from the following code:

Dim strVar As String
Dim intVar1 As Integer
Dim intVar2 As Integer

strVar = "foobar"

intVar1 = strVar.Length
intVar2 = CStr(Len(strVar))

Could someone PLEASE tell me what I'm doing wrong???
Thanks

- Joe

Nov 21 '05 #2
* pr**************@gmail.com (Joe) scripsit:
When I get the length of a string I expect to get an integer back. I
getting back &H6 for both intVar1 and intVar2 from the following code:

Dim strVar As String
Dim intVar1 As Integer
Dim intVar2 As Integer

strVar = "foobar"

intVar1 = strVar.Length
intVar2 = CStr(Len(strVar))

Could someone PLEASE tell me what I'm doing wrong???


Where do ypu get this results? If you are talking about the IDE's
"Watch" window, simply right-click the value and select "Decimal format"
(translated from the German version of VS.NET) from the context menu.

'&H6' is only another "representation" of the variable's value. The
variable itself stores 6 in 'Integer' format, not as a string. So,
inside the application it doesn't make a difference whether hexadecimal
or decimal display is selected.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
question about the code -
1. doesn't "Cstr" return a String data type ?
2. Isn't intVar2 an Integer ?
3. Are you assigning the String output of Cstr to intVar2 ?
4. do you have option strict off?
---what would happen if you removed "Cstr" from that last line of code ?

"Joe" <pr**************@gmail.com> wrote in message
news:fe*************************@posting.google.co m...
Hi,
When I get the length of a string I expect to get an integer back. I
getting back &H6 for both intVar1 and intVar2 from the following code:

Dim strVar As String
Dim intVar1 As Integer
Dim intVar2 As Integer

strVar = "foobar"

intVar1 = strVar.Length
intVar2 = CStr(Len(strVar))

Could someone PLEASE tell me what I'm doing wrong???
Thanks

- Joe

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.744 / Virus Database: 496 - Release Date: 8/24/2004
Nov 21 '05 #4

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

Similar topics

5
by: Michael C | last post by:
I have an array of strings string strArray = new string; strArray = "ABC"; How can I determine the number of characters in the array item? if (strArray.length = = 3) {
1
by: active | last post by:
Private Structure TNavRec <VBFixedString(100),System.Runtime.InteropServices.MarshalAs(System.Runtime. InteropServices.UnmanagedType.ByValTStr,SizeConst:=100)> Public strItemName As String ...
3
by: Sim Zacks | last post by:
I am using 8.0 beta 1 on an RH 8 Linux server. I have a union query that I am converting from access (where it worked) and it is returning duplicates. The only difference between the two rows is...
1
by: suresh | last post by:
Hello all, I have a problem while working with fixed length stings in Vb.net The problem is, when I call a Function FormInfo to return a FormName, which is a string value, it is returning some...
13
by: Paminu | last post by:
I have this function: int test(void *blop) { char *sp; sp = blop; int i; for (i=0; i < LENGTH.sp; i++)
1
by: Sathyaish | last post by:
I have the following scenario: Algorithm: 3DES Cipher Mode: CBC Key Size: 128-bit Block Size: 64 bit IV: 0x0000000000000000 (an eight byte array of zeros) The results I get using .NET with...
1
by: kierenj | last post by:
Hi, I'm trying to send a zipfile to a client using Content-Disposition: attachment. Done it before and it works fine. My code is below: context.Response.Buffer = false;...
14
by: Richard Maher | last post by:
Hi, Can anyone please show me a regular expression (or function or other) for padding out a string to a fixed number of bytes? At the moment I've got a var initialized to N spaces, where 'N'...
2
by: Mike P | last post by:
I have a method that is returning a string which can be of any length. Once this string is returned I want to display it on screen in a label control. How can I make the label control's height and...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.