System Info Object in Dot Net

Merchand

Well-known member
Joined
Dec 28, 2005
Messages
73
Location
USA Eastcoast
Programming Experience
10+
In VB6 we had a SystemInfo control from M$. Do we have any way of getting system info via a native class. Does anyone know of a way to get the same functionality of SystemInfo ActiveX control in one nice package natively?

Any help is greatly appreciated! :)
 
If i uderstand well you can do that as it follows:
(The System.Environment namespace includes the functionality to get the environment information such as the UserName and OS Version)

Dim myOs As OperatingSystem
myOs = Environment.OSVersion
Dim myVersion As Version
myVersion = myOs.Version

then simply say to get the version info

MessageBox.Show(myVersion.Major)

or you can simply say:

VB.NET:
Label1.Text = "OS version :" & ControlChars.NewLine & System.Environment.OSVersion.ToString()

Regards ;)
 
Thanks Kulrom!

What I'm looking for is a way to kick up the whole System Info window like you could do in VB6 using the SystemInfo.ocx. I have some information on how to do this manually using VS2003 System.Management (WMI) object model but I'd have to build the whole interface my self. I'm looking for a higher level of functionality like what was in the SystemInfo.ocx.
 
I do not understand very well your intention ... recently i wrote some post on how to get system info with WMI as well but as i have been never vb6 programmer i am not sure what do you mean when you say: "higher level of functionality like what was in the SystemInfo.ocx"
Please explain maybe we can do that with vb.net only

Regards ;)
 
Merchand, you can also use the old ocx control in a VB.Net project, add item to the Toolbox, select from COM components list.

I am also sure somebody have created newer System Info controls/classes in VB.Net.
 
Thanks guys for the quick feedback! :)

I currently have a VB6 user control that has two status bars and a textbox and the SystemInfo.ocx control emebbed within the user control. I'm trying to reproduce the user control in VS2003 (prototype) then move it to VS2005 soon.

I know I can use com-interop to wrap the ActiveX control (SystemInfo.ocx). Thanks for the tip (JohnH)! I was thinking the same thing this morning driving into work (40 minute drive). However, I'm a purist and was hoping for a more pure .net way. Also, I noticed when you wrap a control in vs2003 it used ax methods and I believe they are depreciated in vb2005. So that would be more work later on down the line...

Do you guys have any feedback on what is going on with the wrapping of controls in vs2005 vs vs2003?
 
Guys, I have some more questions regarding the importing of ActiveX controls...

I have just added a reference in vs2003 to my activex control. Can I instantiate the control in code now or do I have to add the control to my toolbar then add it to my project?

Or, do I need the reference at all?

I have done this before in vs2005 b1 but it's been a while.

All help is greatly appreciated!
 
Depends what you put in the phraze "reference".
You don't add reference to an ActiveX com object like you do with dlls, but register the ActiveX in system with Regsvr.exe.
After it is registered you can add it to toolbox then to form, or just add reference by selecting it from the list of COM libraries.
 
Yes, it was already register on this machine. I added a COM Libraries reference in vs2003 and it shows up under references in the solution explorer as sysinfolib. My question is do I need this if I'm going to add it to the toolbar and then to the project winForm? Or can i use the reference as is and just create an instance of the control in code?

Basically i'm looking for the proper way to add an activex control to my vs2003 project.

JohnH you have been a lot of help! :)
 
yes, you can now create your own instance to work with in code.

adding it to toolbox then to form may give you a designer object with easy to set properties there. you also do this for 'visual' controls you have to work with in designer.
 
Ok, I figured it out...

You can either add a reference under references, then add an imports statement to the sysinfolib (Reference nane), then instantiate the object using New(). And start using it.

Or, you can add the activex control to the toolbar, add it to your form and then start using it.

All this may be just a learning experience... I just figured out I may not even need this control at all. It was only being used to set the location of the work area. May not need it now that the controls dock and anchor. :)
 
Thanks guys for the support and information. I'm getting the hang of it now... been studying vb.net and C# on and off for over 4 yrs now... Created a few projects at home but was still doing vb6 at work.

Took a new job Dec 2 and now i'm getting to play with vs2003 and maybe vs2005 soon. I'm a happy camper as they say. :)
 
Back
Top