How can I get internal HDD_DETLAIS = SerialNumber, Model, Manufacturer,TotalHeads ...... etc.
Please help me.. Now my problem is my code run ok, but when I insert external HDD or pen drive then showing the last counting device Details please help ....
i want to show only internal HHD device means OS loaded disk "C" drive
Thanks

Dim HDD_DETLAIS As String
      Dim HDD As New ManagementObjectSearcher("select * from Win32_DiskDrive")

      For Each HDDDET In HDD.Get
          HDD_DETLAIS = HDDDET("SerialNumber") + "   Model-" + HDDDET("Model") + "   Manufacturer-- " + HDDDET("Manufacturer") ' + "  TotalHeads  -  " + hd("TotalHeads") '+ "   Signature - " + hd("Signature")
          TextBox1.Text = HDD_DETLAIS

      Next

Recommended Answers

All 3 Replies

Rather use a select/case block. return the drive names. If there is a C: drive letter from the returned data, show the detail in your textbox.

I now have PCs with SSD (solid state drives.) Maybe this code is destined to fail in a lot of PCs today. May have to test this widely before you publish.

      For Each HDDDET In HDD.Get
          HDD_DETLAIS = etc
          TextBox1.Text = HDD_DETLAIS
      Next

You loop through all the disks setting the text box to dosplay their details BUT each one immediately overwrites the previous one so all you ever see is the last.

To see all the disks you need to concatenate all the details for all the disks (with newlines inbetwen) in the loop, then display that after the loop.
If you want to display just some disks, test the details to see if you want this one before concatenating its details.

commented: The devil is in the DETLAIS. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.