Disk Infomration SD Card Issue with VB.Net using Win32_DiskDrive

~OSD~ 2,201 Reputation points
2021-03-11T09:25:29.293+00:00

Hi,

I have following code to list the physical disk(s) information:

76708-image.png

When there is SD card available, I get unhandled exception and VB app crashes. The information about the SD card can be gained with PowerShell as:
76568-image.png

Can we modify the code somehow to exclude the disk if it's SD card or manage it in different to include SD card information as well?

Developer technologies | VB
{count} votes

Accepted answer
  1. ~OSD~ 2,201 Reputation points
    2021-03-11T13:54:04.17+00:00

    Thank you both Castorix and Viorel.
    Actual problem was converting the NULL to String as highlighted by Viorel, and omitting the ToString did the trick.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2021-03-11T10:29:05.237+00:00

    SD Card Size is NULL, from your screencopy...

    1 person found this answer helpful.

  2. ~OSD~ 2,201 Reputation points
    2021-03-11T09:45:42.86+00:00

    Cannot upload code, getting following error message.

    76722-image.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.