473,385 Members | 1,531 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,385 software developers and data experts.

Help: Building string value????

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

Jul 22 '05 #1
3 1409
>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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 22 '05 #2
=?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=
<se************@discussions.microsoft.com> wrote in
news:55**********************************@microsof t.com:
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/
Jul 22 '05 #3
Thnaks matias,

your first proposal works now..

"Mattias Sjögren" wrote:
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jul 22 '05 #4

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

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
1
by: Michael Albanese | last post by:
I am building an ASP.Net web application that records employee incident data over several screens. I have built custom classes to hold this information as the user enters data. In order to persist...
3
by: Liz Malcolm | last post by:
Hello and TIA for guidance. I am building a reusable search procedure (thanks go to Graham Thorpe for his example that set me on my way). Everything works up until the 2nd match is found, the...
4
by: Brian Shannon | last post by:
I have 3 combo boxes and two date text boxes on a .aspx page. The user can fill in any of the 5 controls or none to filter a datagrid. I was hoping someone could explain how to efficiently build...
2
by: Sam Samnah | last post by:
I am building a custome control and I need to access the information in the hidden field (HtmlInputHidden HIH) so that when a button is pressed the information in the hidden fields value is...
3
by: ntexchange05 | last post by:
I am trying to learn asp.net and build a site and i am using web matrix and vb.net. I have installed the MSDE on my windows xp pro, i am using the book calledbeginning dynamic websites with...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.