473,804 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question: ChrW in VB.NET

I have a line of code in my project: mobjText.Append (ChrW(Bytes(iIn dex)))

I took out the reference to Microsoft.Visua lBasic in my imports so that I am
forced to use all VB.NET stuff.

What is the replacement for the ChrW function?

Thanks,
Robert
Nov 20 '05 #1
6 9458
I could use Microsoft.Visua lBasic.ChrW, but is there another way?

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
I have a line of code in my project: mobjText.Append (ChrW(Bytes(iIn dex)))

I took out the reference to Microsoft.Visua lBasic in my imports so that I am forced to use all VB.NET stuff.

What is the replacement for the ChrW function?

Thanks,
Robert

Nov 20 '05 #2
You can cast an int or a short directly to a char?
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...
I could use Microsoft.Visua lBasic.ChrW, but is there another way?

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
I have a line of code in my project: mobjText.Append (ChrW(Bytes(iIn dex)))
I took out the reference to Microsoft.Visua lBasic in my imports so that
I am
forced to use all VB.NET stuff.

What is the replacement for the ChrW function?

Thanks,
Robert


Nov 20 '05 #3
VB Programmer,
The easiest way is to use ChrW!
I took out the reference to Microsoft.Visua lBasic in my imports so that I
am
forced to use all VB.NET stuff.
Huh? I hope you realize that Microsoft.Visua lBasic is VB.NET, as the VB in
VB.NET stands for Visual Basic. ;-)

If you meant "forced to use all .NET stuff", I hope you realize that
Microsoft.Visua lBasic is native .NET stuff also! As I've mentioned earlier
there are items in Microsoft.Visua lBasic that makes your live easier, there
are things that "should" be avoided, I question banning the entire Assembly!

You can use Convert.ToChar to convert a byte to a char without encoding.

If you need encoding you will need to use the System.Text.Enc oding class.

Hope this helps
Jay

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl... I could use Microsoft.Visua lBasic.ChrW, but is there another way?

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
I have a line of code in my project:
mobjText.Append (ChrW(Bytes(iIn dex)))
I took out the reference to Microsoft.Visua lBasic in my imports so that

I am
forced to use all VB.NET stuff.

What is the replacement for the ChrW function?

Thanks,
Robert


Nov 20 '05 #4
Hi Guys,
Boy I sure hate typing in Microsoft.Visua lBasic.Whatever . They got rid of
some of that in VB 2003, but it's still required for some commands. If MS
would pull their heads out of their asses they'd make a compiler that would
try substituting Microsoft.Visua lBasic.SomeComm and before giving up on
"SomeComman d" by itself.
Cheers,
Christian
"Jay B. Harlow [MVP - Outlook]" <Ja********@ema il.msn.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
VB Programmer,
The easiest way is to use ChrW!
I took out the reference to Microsoft.Visua lBasic in my imports so
that
I
am
forced to use all VB.NET stuff.
Huh? I hope you realize that Microsoft.Visua lBasic is VB.NET, as the VB in
VB.NET stands for Visual Basic. ;-)

If you meant "forced to use all .NET stuff", I hope you realize that
Microsoft.Visua lBasic is native .NET stuff also! As I've mentioned earlier
there are items in Microsoft.Visua lBasic that makes your live easier,

there are things that "should" be avoided, I question banning the entire Assembly!
You can use Convert.ToChar to convert a byte to a char without encoding.

If you need encoding you will need to use the System.Text.Enc oding class.

Hope this helps
Jay

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...
I could use Microsoft.Visua lBasic.ChrW, but is there another way?

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
I have a line of code in my project:
mobjText.Append (ChrW(Bytes(iIn dex)))
I took out the reference to Microsoft.Visua lBasic in my imports so

that I
am
forced to use all VB.NET stuff.

What is the replacement for the ChrW function?

Thanks,
Robert



Nov 20 '05 #5
Christian,
Huh? :-|
try substituting Microsoft.Visua lBasic.SomeComm and before giving up on
"SomeComman d" by itself. VB.NET 2002 & VB.NET 2003 already supports this:

Be certain to include "Imports Microsoft.Visua lBasic" at the top of your
source file, then you can use Whatever directly. I normally use Whatever
directly! I normally let Microsoft.Visua lBasic be imported under Project
Properties, so I do not need to include it in each source file. (Note using
Project Imports in itself is a debatable practice, which I neither endorse
nor oppose).

Not that I use Strings.Left & Strings.Right, but if I were to use them on a
Form I would use VB.Left & VB.Right, where first I did a import alias:

Imports VB = Microsoft.Visua lBasic

VB.Whatever

As Left & Right are already properties of Control, so the properties get
precedence.

Hope this helps
Jay

"Christian Blackburn" <Christian@Damn @Sp**@Hotmail.c om> wrote in message
news:uY******** ********@TK2MSF TNGP11.phx.gbl. .. Hi Guys,
Boy I sure hate typing in Microsoft.Visua lBasic.Whatever . They got rid of
some of that in VB 2003, but it's still required for some commands. If MS
would pull their heads out of their asses they'd make a compiler that would try substituting Microsoft.Visua lBasic.SomeComm and before giving up on
"SomeComman d" by itself.
Cheers,
Christian
"Jay B. Harlow [MVP - Outlook]" <Ja********@ema il.msn.com> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
VB Programmer,
The easiest way is to use ChrW!
> I took out the reference to Microsoft.Visua lBasic in my imports so that
I
am
> forced to use all VB.NET stuff.

Huh? I hope you realize that Microsoft.Visua lBasic is VB.NET, as the VB

in VB.NET stands for Visual Basic. ;-)

If you meant "forced to use all .NET stuff", I hope you realize that
Microsoft.Visua lBasic is native .NET stuff also! As I've mentioned earlier there are items in Microsoft.Visua lBasic that makes your live easier,

there
are things that "should" be avoided, I question banning the entire

Assembly!

You can use Convert.ToChar to convert a byte to a char without encoding.

If you need encoding you will need to use the System.Text.Enc oding class.
Hope this helps
Jay

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...
I could use Microsoft.Visua lBasic.ChrW, but is there another way?

"VB Programmer" <gr*********@ go-intech.com> wrote in message
news:uV******** ******@tk2msftn gp13.phx.gbl...
> I have a line of code in my project:

mobjText.Append (ChrW(Bytes(iIn dex)))
>
> I took out the reference to Microsoft.Visua lBasic in my imports so

that
I
am
> forced to use all VB.NET stuff.
>
> What is the replacement for the ChrW function?
>
> Thanks,
> Robert
>
>



Nov 20 '05 #6
Hello,

"Christian Blackburn" <Christian@Damn @Sp**@Hotmail.c om> schrieb:
Boy I sure hate typing in Microsoft.Visua lBasic.Whatever .
They got rid of some of that in VB 2003, but it's still required for
some commands. If MS would pull their heads out of their asses
they'd make a compiler that would try substituting Microsoft.
VisualBasic.Som eCommand before giving up on
"SomeComman d" by itself.


In VB.NET projects, the namespace 'Microsoft.Visu alBasic' gets imported
automatically (project imports). You don't need to Type
'Microsoft.Visu alBasic.Strings .Left', only type 'Strings.Left' and so on.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #7

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

Similar topics

6
5526
by: Eddie | last post by:
Hi, Is it possible to make a program in VB.net that will convert letters, numbers etc to Binary Code? I have the tables here that show me exactly what each character works out to, but I was wondering if there is an easier way to do this. Thanks,
6
1907
by: Joe Fallon | last post by:
The ListView control is the one used in Windows Explorer Detail view. When you click a column heading in Windows Explorer to sort the column you get a little triangle pointing up or down depending on the sort direction. How do you get the triangle to appear when you click a column heading on a ListView control in VB.Net? -- Joe Fallon
7
1268
by: Joe Fallon | last post by:
I have a WinForm that is a Base class. It has many controls on it and a lot of generic code behind. When I inherit the form I override 5 methods and now each child form has the same look and feel and functionality. This part all works fine. (I learned this morning that if you override a method that also has an Event Handler then you should NOT include the event handler a 2nd time. I had a devil of a time figuring out why a block of code...
17
5819
by: Mike Labosh | last post by:
I would really rather use the "dot-nettified" syntax rather than digging global functions out of Microsoft.VisualBasic. Anyone know the newfangled way to achieve the same results? -- Peace & happy computing, Mike Labosh, MCSD "Musha ring dum a doo dum a da!" -- James Hetfield
11
2228
by: fniles | last post by:
In VB 6 I used to do like the following: if left(str,3) = "abc" then In VB.NET when I do the following sStr.Substring(0, 3), and the sStr has fewer than 3 characters, it will give me an error. For ex: sStr = "a", if I do sStr.Substring(0, 3), it will give me an error. So, I was forced to do
1
3020
by: Nikos Tsoupros | last post by:
i use vb and i have a problem with encoding in vb.net chrw(204) returns the char I in vb6 the function chrw(204) returns the char I also in vb6 ascw(chrw(204)) returns 73 why??????????????????
1
1126
by: David | last post by:
I have the following two button click procedures to retrieve html code from web sites. The code for Button1 seems to work fine. Button2 works fine for http://yahoo.com but not for http://groups.google.com. When trying the Google site, iContentLength is -1 after it is set to myResponse.ContentLength. Any ideas why? If I uncomment the lines in Button2's event handler then that part of it will work with Google's site, using the same...
0
862
by: raids51 | last post by:
im making a program that basically brute forces a string by converting the first character to its ascii code and then adding one. when the ascii code reaches 126 then the second character will go up one and the first char will start back at 32.then it will convert the ascii codes back to characters and set label 3 to reflect that text.But the problem i have is that when it does it once then each characters index value is decreased by one and the...
2
4109
by: Joe Duchtel | last post by:
Hello - I was wondering why I can do a ... Public Const A As Char = Chr(36) .... but not a ... Public Const B As Char = Chr(165)? It seems like 0-127 are okay with the Chr(). Is this because values > 127 depend on the currently active code page and hence are dynamic?
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.