How can i make that in the ComboBox control it will show only part of each item name without the Win32_ in the start of each item ?

This is my form1 code:
using System;
using System.Collections;
using System.Management;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace GetHardwareInfo
public partial class frmMain : Form
public frmMain()
InitializeComponent();
cmbxOption.SelectedItem = "Win32_Processor";
cmbxStorage.SelectedItem = "Win32_DiskDrive";
cmbxMemory.SelectedItem = "Win32_CacheMemory";
cmbxSystemInfo.SelectedItem = "";
cmbxNetwork.SelectedItem = "Win32_NetworkAdapter";
cmbxUserAccount.SelectedItem = "Win32_SystemUsers";
cmbxDeveloper.SelectedItem = "Win32_COMApplication";
cmbxUtility.SelectedItem = "Win32_1394Controller";
private void InsertInfo(string Key, ref ListView lst, bool DontInsertNull)
lst.Items.Clear();
ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + Key);
try
foreach (ManagementObject share in searcher.Get())
ListViewGroup grp;
try
grp = lst.Groups.Add(share["Name"].ToString(), share["Name"].ToString());
catch
grp = lst.Groups.Add(share.ToString(), share.ToString());
if (share.Properties.Count <= 0)
MessageBox.Show("No Information Available", "No Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
foreach (PropertyData PC in share.Properties)
ListViewItem item = new ListViewItem(grp);
if (lst.Items.Count % 2 != 0)
item.BackColor = Color.White;
else
item.BackColor = Color.WhiteSmoke;
item.Text = PC.Name;
if (PC.Value != null && PC.Value.ToString() != "")
switch (PC.Value.GetType().ToString())
case "System.String[]":
string[] str = (string[])PC.Value;
string str2 = "";
foreach (string st in str)
str2 += st + " ";
item.SubItems.Add(str2);
break;
case "System.UInt16[]":
ushort[] shortData = (ushort[])PC.Value;
string tstr2 = "";
foreach (ushort st in shortData)
tstr2 += st.ToString() + " ";
item.SubItems.Add(tstr2);
break;
default:
item.SubItems.Add(PC.Value.ToString());
break;
else
if (!DontInsertNull)
item.SubItems.Add("No Information available");
else
continue;
lst.Items.Add(item);
catch (Exception exp)
MessageBox.Show("can't get data because of the followeing error \n" + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
private void RemoveNullValue(ref ListView lst)
foreach (ListViewItem item in lst.Items)
if (item.SubItems[1].Text == "No Information available")
item.Remove();
#region Control events ...
private void cmbxNetwork_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxNetwork.SelectedItem.ToString(), ref lstNetwork, chkNetwork.Checked);
private void cmbxSystemInfo_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxSystemInfo.SelectedItem.ToString(), ref lstSystemInfo, chkSystemInfo.Checked);
private void cmbxUtility_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxUtility.SelectedItem.ToString(), ref lstUtility, chkUtility.Checked);
private void cmbxUserAccount_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxUserAccount.SelectedItem.ToString(), ref lstUserAccount, chkUserAccount.Checked);
private void cmbxStorage_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxStorage.SelectedItem.ToString(), ref lstStorage, chkDataStorage.Checked);
private void cmbxDeveloper_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxDeveloper.SelectedItem.ToString(), ref lstDeveloper, chkDeveloper.Checked);
private void cmbxMemory_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxMemory.SelectedItem.ToString(), ref lstMemory, chkMemory.Checked);
private void chkHardware_CheckedChanged(object sender, EventArgs e)
if (chkHardware.Checked)
RemoveNullValue(ref lstDisplayHardware);
else
InsertInfo(cmbxOption.SelectedItem.ToString(), ref lstDisplayHardware, chkHardware.Checked);
private void cmbxOption_SelectedIndexChanged(object sender, EventArgs e)
InsertInfo(cmbxOption.SelectedItem.ToString(), ref lstDisplayHardware, chkHardware.Checked);
private void chkDataStorage_CheckedChanged(object sender, EventArgs e)
if (chkDataStorage.Checked)
RemoveNullValue(ref lstStorage);
else
InsertInfo(cmbxStorage.SelectedItem.ToString(), ref lstStorage, chkDataStorage.Checked);
private void chkMemory_CheckedChanged(object sender, EventArgs e)
if (chkMemory.Checked)
RemoveNullValue(ref lstMemory);
else
InsertInfo(cmbxMemory.SelectedItem.ToString(), ref lstStorage, false);
private void chkSystemInfo_CheckedChanged(object sender, EventArgs e)
if (chkSystemInfo.Checked)
RemoveNullValue(ref lstSystemInfo);
else
InsertInfo(cmbxSystemInfo.SelectedItem.ToString(), ref lstSystemInfo, false);
private void chkNetwork_CheckedChanged(object sender, EventArgs e)
if (chkNetwork.Checked)
RemoveNullValue(ref lstNetwork);
else
InsertInfo(cmbxNetwork.SelectedItem.ToString(), ref lstNetwork, false);
private void chkUserAccount_CheckedChanged(object sender, EventArgs e)
if (chkUserAccount.Checked)
RemoveNullValue(ref lstUserAccount);
else
InsertInfo(cmbxUserAccount.SelectedItem.ToString(), ref lstUserAccount, false);
private void chkDeveloper_CheckedChanged(object sender, EventArgs e)
if (chkDeveloper.Checked)
RemoveNullValue(ref lstDeveloper);
else
InsertInfo(cmbxDeveloper.SelectedItem.ToString(), ref lstDeveloper, false);
private void chkUtility_CheckedChanged(object sender, EventArgs e)
if (chkUtility.Checked)
RemoveNullValue(ref lstUtility);
else
InsertInfo(cmbxUtility.SelectedItem.ToString(), ref lstUtility, false);
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
linkLabel1.LinkVisited = true;
System.Diagnostics.Process.Start("http://www.test.net");
#endregion
What i get is in the end that in the ComboBox in this case i call it cmbxNetwork i see in it many items all start with Win32_ For example when i click on ComboBox i see the first item is: "Win32_NetworkAdapter"
Instead Win32_NetworkAdapter i want to see in the ComboBox only: NetworkAdapter But when i select the item it should be selected as Win32_NetworkAdapter but the user should see and select only NetworkAdapter.
I want to remove as test from the ComboBox items the Win32_ But only that the user will see it without Win32_
Also in the constructor when i'm doing now: cmbxNetwork.SelectedItem = "Win32_NetworkAdapter"; so instead if i'm doing: cmbxNetwork.SelectedItem = "NetworkAdapter"; it will be enough. THe program will use the "Win32_NetworkAdapter";
but again what i see and user in the ComboBox as item is only the NetworkAdapter

Hi Chocolade1972,
>> I want to remove as test from the ComboBox items the Win32_ But only that the user will see it without Win32_  Also in the constructor when i'm doing now: cmbxNetwork.SelectedItem = "Win32_NetworkAdapter"; so instead if i'm doing:
cmbxNetwork.SelectedItem = "NetworkAdapter";
Do you mean that you want the ComboBox show the value of “NetworkAdapter” in the text, but when you refer the value of the cmbxNetwork.SelectedItem, it will be “Win32_NetworkAdapter”? If so, I am afraid that you need create your own ComboboxItem and override
the ToString() method to return the text you want.
You could modify the code below for your own achievement.
public partial class Form0417 : Form
public Form0417()
InitializeComponent();
public class ComboboxItem
public string Text { get; set; }
public object Value { get; set; }
public override string ToString()
return Text;
private void Form0417_Load(object sender, EventArgs e)
ComboboxItem item1 = new ComboboxItem();
item1.Text = "Processor";
item1.Value = "Win32_Processor";
ComboboxItem item2 = new ComboboxItem();
item2.Text = "DiskDrive";
item2.Value = "Win32_DiskDrive";
cmbxOption.Items.Add(item1);
cmbxOption.Items.Add(item2);
//MessageBox.Show((cmbxOption.SelectedItem as ComboboxItem).Value.ToString());
private void cmbxOption_SelectedIndexChanged(object sender, EventArgs e)
MessageBox.Show((cmbxOption.SelectedItem as ComboboxItem).Value.ToString());
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How can I make that the cursor of a table ...

    Hello,
    how can I make that the cursor of a table (on the frontpanel) go to the starting position? I have placed a table that give back the number of the row if I doubleclick a row on the frontpanel, but when I restart the vi the cursor of the table is on this position. If I have many informations in the table and after restarting there are just one or two, I can`t see this information without scrolling to the top of the table. I want that the cursor (that I see) is at the first row. How can I make it?
    thankyou
    Schwede

    Hello,
    Sorry, I forgot to attach it in the previous post.
    Regards,
    Paulo
    Attachments:
    EditPos.vi ‏16 KB

  • When I am connected to my home wifi, it says I am connected but the 4G icon doesn't go away.  How can I make that go away when I am connected?

    When I am connected to my home wifi, it says I am connected but the 4G icon doesn't go away.  How can I make that go away when I am connected?

    When I'm at my home, and on my Wifi, my 4G icon on my LG G2 is still present. No big deal. If the bits can flow via WiFi, that's what they'll do.
    You might try (if you really MUST shut off the cellular radio):
    Settings, Network Connections and More networks. Select Mobile Networks and uncheck Mobile data and data roaming.
    Not sure if that will work - but give it a try.

  • I just downgraded from iTunes 11 back to itunes 10.7.5. My iTunes is now working from one of the Previous Music Librabies. How can I make that previous library my current library? Also, I can't empty iTunes 11 frome the trash. Why not?

    I just downgraded from iTunes 11 back to itunes 10.7.5. My iTunes is now working from one of the Previous Music Librabies. How can I make that previous library my current library? Also, I can't empty iTunes 11 frome the trash. It tells me iTunes 11 is still open. What's going on?
    Thanks in advance!

    Without providing details on exactly what you did it is hard to provide an answer.  It's like me saying, "This chocolate cake I made tastes wrong," but not providing the recipe for review.  Maybe it was the garlic in that particular recipe.
    If iTunes is successfully using a previous library which you rename to iTunes Library.itl then that is now the current library.
    Have you restarted your computer and then tried emptying the trash?

  • New windows don't open on top of each other in Firefox. How can I make that happen?

    New windows don't open on top of each other in Firefox. How can I make that happen? That is, every time I open a new window, it won't open on top of the old window, and instead is positioned to the right of it. I'm on a mac. Please help.
    == This happened ==
    Every time Firefox opened
    == Today

    I see. I'm not aware of how to fix this in Firefox. Usually you want to tweak your Winow Manager preferences for opening new windows.
    Example: sawfish preferences for Linux.
    Since Mac OS X doesn't have any preferences, you have to use Applescript or another technique. I found [http://amitp.blogspot.com/2006/08/mac-os-x-window-management-spooky.html Spooky], maybe there are others. I haven't tried it, but here is the [http://www.doernte.net/spooky.html Spooky Download and Description].

  • Connect 2 iPhones with 2 different apple ids to the macbook for updates and backup through iTunes match and iCloud. How can i make that happen?

    We have a mac book pro and 2 i phones 4S. We both have different Apple Id's. But we would like to connect both phones to the mac book in order to update photos and itunes match. I subscribed with my apple id to itunes match and it automatically updates apps, music, books etc. However the apple id of my husbands phone is not recognized so his music, apps etc are not automatically updated. The same happens with icloud.
    How can we make the mac book recognize both phones?

    I believe because you migrated from a Nokia to an iPhone you need to register the Bn phone number with your Apple ID so it can be used for iMessage. The Pn number seems to be the only one registered
    Go here > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    Manage your Apple ID and see if that does the trick
    Hope that helps

  • I forgot my Apple ID security question answers and cannot contact iTunes support by phone. The only way I can ask for help is via email. How can I make that happen?             Thanks

    Hi! So I haven't used iTunes in a few months but I just got an iTunes gift card and want to make a purchase. iTunes redeemed it just fine but now that I want to make a purchase I am having problems. I can't remember my security question answers and iTunes is requesting them. I have two other verified emails but the are NOT rescue emails. I can't contact iTunes over the phone because my phone lines are out and are going to be out for a long time. The only way I can contact them is by email. How can I do this? Is there an easy way to just reset all my security questions? Please help a girl out. I just want my music!
    Thanks so much

    Alternatives to Reset Security Questions and Rescue Mail
         1. Apple ID- All about Apple ID security questions.
         2. Rescue email address and how to reset Apple ID security questions
         3. Start here to find your country, and how you can contact Apple:
             Apple ID- Contacting Apple for help with Apple ID account security.
         4. Fill out and submit this form. Select the topic, Account Security.
         5.  Call Apple Support in your country and ask to speak to Account Security.
              Customer Service: Contacting Apple for support.
    How to Manage your Apple ID: Manage My Apple ID

  • The new Firefox opens all the old tabs it closed with, when it starts. I'd rather just start a new session. How can I make that the default setting?

    The new Firefox re-opens all the tabs it closed with; and, I'd rather just start a new session, as the default setting. How can I do this? It would make it easier on me, the machine, and the Internet feed, not to reload automatically a bunch of tabs that were just closed. There must be someway to fix this. This happens on my brother's Windows computer, as well; and, it's running Firefox 4. Thanks for your help.

    Make that "Firefox ->Preferences -> General -> When Firefox starts: "Show my windows and tabs from last time" is not selected as this is not the default.
    Basically this setting will make Firefox start with whatever windows and tabs that were last open when a user closes Firefox by way of File ->Quit/Exit as if Firefox was never closed.

  • An app, pet hotel, kicks me off when I touch anythng on the screen.   How can I make that stop so that I can play the app?

    Pet hotel kicks meoff of app whenever I tap on the screen.  How do I make it stop so that I can play?

    Try here:
    iOS: Troubleshooting applications purchased from the App Store

  • When adding a new contact in address book, I want the default for display to be last, first. How can I make that the default?

    I want names displayed in my address books in a formal manner:
    Jones, Fred
    Nixon, Jay
    Smith, Gertrude
    and I would prefer that display be created in that manner when I enter first and last names.
    Thanks
    Del

    Open the Address Book
    Select '''View-Show Name As-Last, First'''

  • I use the weather add-on, which says it can change locations every 5 minutes, but it never changes...how can I make that option work?

    The weather add-on allows for entering multiple locations, and asks how often you'd like it to switch the display to show the current weather in different places. I chose "5 minutes", but it never changes.

    Does the author of the add-on provide any support? If they do provide support you would be better off asking the author.
    What add-on is it, there are quite a few weather add-ons.

  • Centro, when Im on the internet no pictures will show only a small red and blue picture

    I don't know what happend to my Centro. My son was playing with it (yeah I know mistake #1) and when I had gotten it back I went to log onto espn.com and none of the pictures would show only a small picture frame with what looks like a sun set over blue waters with a red sky. I went to other websites (cnn, flickr, and so on) but no pitures will show up. What could be the problem?
    Post relates to: Centro (Sprint)
    This question was solved.
    View Solution.

    Check your settings in Blazer.  Sounds like you've changed it to "Fast Mode" for displays.
    Tap the Lightning bolt icon at the top of Blazer, and see if it's set to Fast Mode.  Change it to "Normal".
    Pictures should load now.
    WyreNut
    Post relates to: Centro (AT&T)
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • I have created an interaction to show 7 groups and 7 clickable objects. Once all are click the Next Button is show. How can you make that work if you want to embeded the SWF just created but show a button in a master Captivate?

    In flash you can have a shell that has the navigation and some button in the shell are not activated until all clickable objects are clicked.  I am not a flash programmer but it was related to using the path of shell and the sub-project.
    Can anybody help me on that.
    I would like to create Captivate interaction that you can just embedded in a Shell captivate project.
    Do I need to set variables at both levels (Global variable. 

    Hello Lieve, That is the screen shot of my custom interactivity, when all labels are clicked the Continue button will be shown because there is a conditional validating if all Labels have now a value of 1. What I am trying to achieve is to create an interaction where where the continue button (an the back button would reside in another Captivate project. This way there is no reprograming required or use of share-actions.  Everytime we use a similar advanced action or a shared action we have to make sure the object name in the advanced actions or conditional actions are not the same.  I trying to make it a bit dump proof for somebody that does not know any thing about advanced  action and just reuse the label interaction in may projects.  (The only thing they would change would be the image and the content of the label.
    Do you thing I going in the right direction.  (As I said before I have custom javacript in Captivate 5.5) to unlock un button that was part of the LCMS ForceTen). I belive the word .this was part of the object path in the JavaScript.  Can we hide and show a Captivate button.
    I have embedded other Captivate animation in a Master Captivate but the objets were not talking to each other. (You can see a sample http://www.youtube.com/watch?v=Erm4_qdybiA&feature=youtube_gdata). In that sample the continue is always there and can be click anytime.  The 3 steps animation has been done as another project and embedded in my main captivate.  I would like to implement a solution where a my 7 labels have to be clicked in the subproject before showing and enabling the Continue button.
    I hope my explanation is clear enough.

  • I ONLY HAVE ONE BLANK TAB ON TOP AND HAVE TO HIT CTRL T TO ALLOW A NEW ONE WITHOUT LOSING THE EXISTIN TAB. THAT NEVER USED TO HAPPEN. THERE WAS ALWAYS A PLACE i COUND PUT A NEW ADDRESS. HOW CAN I MAKE THAT ALWAYS COME UP?

    When I do control T a new tab gets added and then a little one with a + on it. otherwise when I put a new address on the tab I have open changes and I loose what's on it because it goes to the new address instead of opening another tab.

    Welcome to the discussions,
    a manual backup should help to transfer your data and apps.
    Disable autosync in itunes, connect your phone, right click on it in the device list and choose backup. iTunes will backup your phone without syncing and save data, pictures taken with the phone and settings to the new itunes library.
    See what's included in this backup here: http://support.apple.com/kb/HT1766
    After that, transfer your purchases the same way by choosing "transfer purchases", to copy all apps and bought media from the Store to your computer.
    Set up at least one contact and event on your computer to be able the merge your calendars and contacts after your phone got wiped during the first sync.
    The rest of the data can be restored again from the manual backup you made before.
    Music is one way only, from the computer to your device, unless you bought the songs in itunes and transferred your purchases.
    There is 3rd party software out there, but not supported by Apple, see this thread: http://discussions.apple.com/thread.jspa?threadID=2013615&tstart=0
    Restoring: http://support.apple.com/kb/HT1414
    Apps can be downloaded again for free, in case you missed some: http://support.apple.com/kb/HT2519

  • I downloaded the apps but, they are not appearing in the app folder, how can I make that appear?

    Apps will not appear in my folder.

    you have a mac os?
    if yes, you downloaded and installed the creative cloud desktop app?
    if yes, you used the desktop app to install your other apps?

Maybe you are looking for