473,806 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does <object>["text"] mean?

2 New Member
Being new to VB, I'm trying to understand what a construct like ["name"] means and how to use it. I thought anything with brackets is an escaped variable to allow using keywords like boolean, as in [boolean]. But I don't get this construct, especially in conjuction with an object, as in mo["name"] in the example below. Is mo["name"] an array element? What exactly is it and how do you use it?

Console.WriteLi ne("Computer details retrieved using Windows Management Instrumentation (WMI)");
ManagementObjec tSearcher query1 = new ManagementObjec tSearcher("SELE CT * FROM Win32_Operating System");
ManagementObjec tCollection queryCollection 1 = query1.Get();
foreach (ManagementObje ct mo in queryCollection 1)
{
Console.WriteLi ne("Name : " + mo["name"].ToString());
Console.WriteLi ne("Version : " + mo["version"].ToString());
}
Sep 10 '07 #1
4 2340
VBPhilly
95 New Member
Being new to VB, I'm trying to understand what a construct like ["name"] means and how to use it. I thought anything with brackets is an escaped variable to allow using keywords like boolean, as in [boolean]. But I don't get this construct, especially in conjuction with an object, as in mo["name"] in the example below. Is mo["name"] an array element? What exactly is it and how do you use it?

Console.WriteLi ne("Computer details retrieved using Windows Management Instrumentation (WMI)");
ManagementObjec tSearcher query1 = new ManagementObjec tSearcher("SELE CT * FROM Win32_Operating System");
ManagementObjec tCollection queryCollection 1 = query1.Get();
foreach (ManagementObje ct mo in queryCollection 1)
{
Console.WriteLi ne("Name : " + mo["name"].ToString());
Console.WriteLi ne("Version : " + mo["version"].ToString());
}
It looks like an array or collection.
However, the curly braces tell me this is not VB.
I would check with the C# folks to be certain. But, I think "mo" is an array/collection and the "name" and "versions" are indexes of the mo object.
Sep 10 '07 #2
VBPhilly
95 New Member
Being new to VB, I'm trying to understand what a construct like ["name"] means and how to use it. I thought anything with brackets is an escaped variable to allow using keywords like boolean, as in [boolean]. But I don't get this construct, especially in conjuction with an object, as in mo["name"] in the example below. Is mo["name"] an array element? What exactly is it and how do you use it?

Console.WriteLi ne("Computer details retrieved using Windows Management Instrumentation (WMI)");
ManagementObjec tSearcher query1 = new ManagementObjec tSearcher("SELE CT * FROM Win32_Operating System");
ManagementObjec tCollection queryCollection 1 = query1.Get();
foreach (ManagementObje ct mo in queryCollection 1)
{
Console.WriteLi ne("Name : " + mo["name"].ToString());
Console.WriteLi ne("Version : " + mo["version"].ToString());
}
Ok, I figured I could give some more detail

mo is an object of type ManagementObjec t which exists in the queryCollection 1 which is of type ManagementObjec tCollection.
mo is the object, "name" and "version" are properties of ManagementObjec t. I hope I donthave to explain ToString to you :)
Sep 10 '07 #3
Killer42
8,435 Recognized Expert Expert
Looks like Java, to me.
Sep 10 '07 #4
Rasarx
2 New Member
Thank you all. I saw that code chunk on a web site under VB samples and I thought there was something in VB that I couldn't figure out. You are right. It is some other language.
Sep 11 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6832
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
22
3353
by: Dr Duck | last post by:
GDay all, Something seems odd to me.... I wrote a simple C# function public void bind(ref object a, ref object b, bool atob) { if(atob) b = a; else
9
5383
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot of try. Thanks in advance.
6
5271
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> My question is how do I access the document DOM of this object in Javascript? For example, "alert(extendedhtml.innerHTML);" doesn't work and produces an unknown error. I'd like to both read and write to the document's body element's innerHTML...
2
1430
by: Guoqi zheng | last post by:
Dear sir, I am using the default paging function of datagrid. Below is my code. <PagerStyle NextPageText="&gt;&gt;&gt;" PrevPageText="&lt;&lt;&lt;" HorizontalAlign="Center" Mode="NumericPages"></PagerStyle> It works fine, it show a 1 2 3 4 5 page nr. at the bottom of datagrid. However, what I want is that before 1 2 3 4 5, I would like to show a text
4
2726
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the source of the files...
8
1367
by: active | last post by:
I use quickwatch on (astrThisOne <> "") and it reports: False as it should because astrThisOne reports: "" Yet If (astrThisOne <> "") Then executes the Then clause
1
6192
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if" src="http://.../">
0
9719
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
9599
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
10624
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
10111
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9193
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
6877
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();...
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3853
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
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.