Try statement not catching the exception vb.net -
my exception isn't working excel file searched , returned information. below see cycles through first column , returns information according variables set globally. have put exception if try fails message box pop , tell them failed find them, not catching it. instead if user isn't listed in database freezes program.
private sub exceptiontoolstripmenuitem_click(byval sender system.object, byval e system.eventargs) handles exceptiontoolstripmenuitem.click dim objexcel new excel.application dim objworkbook excel.workbook dim objworksheet excel.worksheet objexcel.displayalerts = false if global_variables.savedresults.userm = nothing , global_variables.savedresults.userl = nothing objworkbook = objexcel.workbooks.open("filepath", [readonly]:=true) objworksheet = ctype(objworkbook.worksheets.item("sheet1"), excel.worksheet) try x integer = 1 objworksheet.rows.count step 1 if objworksheet.cells(x, 1).value = global_variables.savedresults.userd global_variables.savedresults.userl = objworksheet.cells(x, 3).value global_variables.savedresults.userm = objworksheet.cells(x, 2).value exit end if next exit try catch ex exception msgbox("you not in database.") end try objworkbook.close() objexcel.quit() releaseobject(objworksheet) releaseobject(objworkbook) releaseobject(objexcel) objworkbook = nothing objworksheet = nothing objexcel = nothing end if dim email new email_templates email.exception() end sub
Comments
Post a Comment