Click here to Skip to main content
15,906,816 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionCancel Event Pin
dptalt19-Apr-07 10:30
dptalt19-Apr-07 10:30 
AnswerRe: Cancel Event Pin
nlarson117-May-07 7:41
nlarson117-May-07 7:41 
QuestionSerialNumber of an Xp Machine Pin
Thoombath19-Apr-07 10:26
Thoombath19-Apr-07 10:26 
AnswerRe: SerialNumber of an Xp Machine Pin
Dave Kreskowiak19-Apr-07 15:32
mveDave Kreskowiak19-Apr-07 15:32 
GeneralRe: SerialNumber of an Xp Machine Pin
Thoombath20-Apr-07 4:47
Thoombath20-Apr-07 4:47 
GeneralRe: SerialNumber of an Xp Machine Pin
Dave Kreskowiak20-Apr-07 4:52
mveDave Kreskowiak20-Apr-07 4:52 
GeneralRe: SerialNumber of an Xp Machine Pin
Thoombath20-Apr-07 5:41
Thoombath20-Apr-07 5:41 
GeneralRe: SerialNumber of an Xp Machine Pin
Dave Kreskowiak20-Apr-07 6:06
mveDave Kreskowiak20-Apr-07 6:06 
Then no SerialNumber object was returned, or that object isn't in the collection. Calling Trim on it fails because you can't do this:
Nothing.Trim

Wrap that line and the next one in a Try/Catch block to ignore any errors:
For Each obj As ManagementObject In objectCollection
    ' The ListView is assumed to have two columns setup to old these.
    Try
        Dim newItem As New ListViewItem(New String() {CStr(obj("Tag")), CStr(obj("SerialNumber")).Trim})
        ListView1.Items.Add(newItem)
    Catch
        ' Warning!  This will ignore ANY AND ALL ERRORS with the above two lines of code!
        ' In a production environment, this is usually NOT a good idea!
    End Try
Next




Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: SerialNumber of an Xp Machine Pin
Thoombath20-Apr-07 6:51
Thoombath20-Apr-07 6:51 
GeneralRe: SerialNumber of an Xp Machine Pin
Dave Kreskowiak20-Apr-07 7:10
mveDave Kreskowiak20-Apr-07 7:10 
GeneralRe: SerialNumber of an Xp Machine Pin
Thoombath20-Apr-07 8:15
Thoombath20-Apr-07 8:15 
GeneralRe: SerialNumber of an Xp Machine Pin
Dave Kreskowiak20-Apr-07 8:40
mveDave Kreskowiak20-Apr-07 8:40 
GeneralRe: SerialNumber of an Xp Machine Pin
Thoombath20-Apr-07 11:00
Thoombath20-Apr-07 11:00 
QuestionSerialNumber/HardDrive Details Pin
Thoombath19-Apr-07 9:41
Thoombath19-Apr-07 9:41 
AnswerRe: SerialNumber/HardDrive Details Pin
Dave Kreskowiak19-Apr-07 9:45
mveDave Kreskowiak19-Apr-07 9:45 
GeneralRe: SerialNumber/HardDrive Details Pin
Thoombath19-Apr-07 10:29
Thoombath19-Apr-07 10:29 
QuestionStartup Project Pin
TenmanS1419-Apr-07 6:50
TenmanS1419-Apr-07 6:50 
AnswerRe: Startup Project Pin
Dave Kreskowiak19-Apr-07 7:10
mveDave Kreskowiak19-Apr-07 7:10 
GeneralRe: Startup Project Pin
TenmanS1419-Apr-07 7:11
TenmanS1419-Apr-07 7:11 
GeneralRe: Startup Project Pin
kubben19-Apr-07 8:57
kubben19-Apr-07 8:57 
GeneralRe: Startup Project Pin
Dave Kreskowiak19-Apr-07 9:03
mveDave Kreskowiak19-Apr-07 9:03 
GeneralRe: Startup Project Pin
kubben19-Apr-07 9:13
kubben19-Apr-07 9:13 
GeneralRe: Startup Project Pin
Dave Kreskowiak19-Apr-07 9:14
mveDave Kreskowiak19-Apr-07 9:14 
GeneralRe: Startup Project Pin
kubben19-Apr-07 9:15
kubben19-Apr-07 9:15 
GeneralRe: Startup Project Pin
Dave Kreskowiak19-Apr-07 9:21
mveDave Kreskowiak19-Apr-07 9:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.