Help: Building string value????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I need to determine the available disk space on a certain drive
for that I have used the following

mngObj = "win32_logicaldisk.deviceid=""E:"""
m_diskMngt = New ManagementObject(mngObj)

This works fine, but now my drive letter is a variable and I try to rebuild
that string as :
mngObj = "win32_logicaldisk.deviceid=" &"''" &myDrive &"''''"
Always get error of Invalid parameter,problem is the way to represent the
double quote for that function. IN my case I have use 2 time the ' characters
but seems to not work

Any help will be apprecaite
Regards
serge
 
This works fine, but now my drive letter is a variable and I try to rebuild
that string as :
mngObj = "win32_logicaldisk.deviceid=" &"''" &myDrive &"''''"
Always get error of Invalid parameter,problem is the way to represent the
double quote for that function. IN my case I have use 2 time the ' characters
but seems to not work

Single quotes (') don't have to be escaped inside a string. So try

mngObj = "win32_logicaldisk.deviceid='" & myDrive & "'"

or

mngObj = "win32_logicaldisk.deviceid=""" & myDrive & """"



Mattias
 
=?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=
mngObj = "win32_logicaldisk.deviceid=" &"''" &myDrive &"''''"
Always get error of Invalid parameter,problem is the way to represent
the double quote for that function. IN my case I have use 2 time the '
characters but seems to not work

How would you expect ' + ' to be interpreted as " ?

Try using a character value (34 IIRC) or """" (4 "). I dont remmeber if the latter works in VB.NET or not.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 
Thnaks matias,

your first proposal works now..

Mattias Sjögren said:
Single quotes (') don't have to be escaped inside a string. So try

mngObj = "win32_logicaldisk.deviceid='" & myDrive & "'"

or

mngObj = "win32_logicaldisk.deviceid=""" & myDrive & """"



Mattias
 
Back
Top