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 8924153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:19:59+00:00 2026-06-15T07:19:59+00:00

Brief info on the code is as follows. The code takes a bunch of

  • 0

Brief info on the code is as follows. The code takes a bunch of strings and concants them as follows with a if statement in the middle that decides whether to concant or not on one of them. The problem is the If(Evaluation, "", "") is complaining saying that it must not be nullable or must be a resource.. How do I work around this when the Evaluation simply checks an object to make sure it IsNot Nothing and also that a property in the object is checked as follows:

Dim R as string = stringA & " * sample text" & _
    stringB & " * sample text2" & _
    stringC & " * sameple text3" & _
    If(ApplyValue IsNot Nothing AndAlso ApplyValue.CheckedBox Then ,StringD & " * sample text4" & _
    , NOTHING)
stringE & " * sample text5"

VS is complaining about the applyValue. Any Ideas?

Should be noted that I have tried the following just to see if it would work and VS is rejecting it:

Dim y As Double
Dim d As String = "string1 *" & _
    "string2 *" & _
    If(y IsNot Nothing, " * sample text4", "") & _
    "string4 *"

This is what it is flagging the y with:

  'IsNot' requires operands that have reference types, but this operand has the value type 'Double'.    C:\Users\Skindeep\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 13  16  WindowsApplication1
  • 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-06-15T07:20:00+00:00Added an answer on June 15, 2026 at 7:20 am

    Use the IIF ternary expression evaluator

    Dim R as string = stringA & " * sample text" & _
                      stringB & " * sample text2" & _
                      stringC & " * sameple text3" & _
                      IIf(ApplyValue IsNot Nothing AndAlso ApplyValue.CheckedBox, StringD & " * sample text4", "") & _
                      stringE & " * sample text5"
    

    EDIT: If you use VB.NET from ver 2008 onward you could use also the

    IF(expression,truepart,falsepart)
    

    and this is even better because it provides the short-circuit functionality.

    Dim R as string = stringA & " * sample text" & _
                      stringB & " * sample text2" & _
                      stringC & " * sameple text3" & _
                      If(ApplyValue IsNot Nothing AndAlso ApplyValue.CheckedBox, StringD & " * sample text4", "") & _
                      stringE & " * sample text5"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In brief: What is the pattern called in the following code, and how should
Here's a brief rundown of my issue: I have a JavaScript function that gets
Brief summary: I need a script/plugin for Firefox that selects the load next 25
Brief synopsis, this code works beautifully and does what it is supposed except with
Brief version of my question: This code crashes the compiler. pThread[0] = new boost::thread(
Right now I have a loop in the view that displays a brief description
I'll try to make a brief description of my Selenium framework so that I
BRIEF: How do you ensure that there is no unsaved work in any DVCS's
BRIEF: hg clone creates path default in /.hg/hgrc, set to where you cloned from.
Brief Context: Hi, I am a university student (behind proxy 10.3.100.211:8080), new to ROR,

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.