Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:32:40+00:00 2026-05-30T21:32:40+00:00

MVC3 VB.NET application. I have the below section of code in a function. This

  • 0

MVC3 VB.NET application. I have the below section of code in a function. This code is supposed to only fire if the handout1 is not nothing. But for some reason it is going into the then block when the handout1 is nothing in the database… I have tried a hundred different ways of checking but it is still trying to run that line of code even when there is nothing to assign to it….

If Not _class1.Contains("---") Then
    _body = _body.Replace("[[Class1]]", _class1 + " : " + _day1Class.course_title)
    Dim _coursesREF As cours = db.courses.Where(Function(f) f.course_ref = class1).First
    If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse Not IsDBNull(_coursesREF.handoutFile1) Then
        _class1Handout = New Net.Mail.Attachment((Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CourseHandouts\") + _coursesREF.handoutFile1)
    End If
Else
    _body = _body.Replace("[[NL]][[Class1]]", String.Empty)
End If

Anyone see what I am obviously overlooking???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:32:41+00:00Added an answer on May 30, 2026 at 9:32 pm

    Try putting a break point in and see what Handout is equal to

    If Not _class1.Contains("---") Then
    
    
       ''# Put a breakpoint on the next line
       Dim breakVariable = handout1
       ''# when the breakpoint fires, inspect the value of `handout1`
    
    
       _body = _body.Replace("[[Class1]]", _class1 + " : " + _day1Class.course_title)
       Dim _coursesREF As cours = db.courses.Where(Function(f) f.course_ref = class1).First
        If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse Not IsDBNull(_coursesREF.handoutFile1) Then
                                    _class1Handout = New Net.Mail.Attachment((Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CourseHandouts\") + _coursesREF.handoutFile1)
         End If
     Else
        _body = _body.Replace("[[NL]][[Class1]]", String.Empty)
     End If
    

    also, upon further inspection, can you modify

    If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) OrElse 
       Not IsDBNull(_coursesREF.handoutFile1) Then
    

    and change it to

    If Not String.IsNullOrWhiteSpace(_coursesREF.handoutFile1) AndAlso 
       Not(_coursesREF.handoutFile1 Is Nothing) Then
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MVC3 VB.NET application using Itextsharp. I have a section of code that generates a
In an ASP.NET MVC3 application I have a function that looks like: Public Sub
My application is in Asp.Net MVC3 coded in C#.Net. I have Views which contains
MVC3 vb.net Application using built in session management. I have an mvc3 application that
I am building an asp.net mvc3 application and I have decided to use areas
I have an ASP.NET MVC3 application in which I am creating multiple areas, is
Here's the issue at hand: I have developed an ASP.NET MVC3 application using Razor.
I'm writing an ASP.net MVC3 application using Entity Framework Code First and SqlCe4. I
I have the following WebGrid in my ASP.NET MVC3 test application. It displays a
I am working on asp.net MVC3 application and I have created a layout.cshtml which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.