Check for a Blank space in a text

How can I check that if my FeatureComment is not a text or numeric value then I just leave it as a blank space.
objStreamWriter.WriteLine(_partfile.PartfileData(intloop).FeatureName.PadRight(10, " "c) & " " & "-" & " " & _partfile.PartfileData(intloop).FeatureType.PadRight(5, " "c) & " " & "-" & " " & _partfile.PartfileData(intloop).FeatureComment)
                        objStreamWriter.WriteLine(_partfile.PartfileData(intloop).FeatureName.PadRight(10, " "c) & " " & "X" & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "Y" & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "Z" & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "D" & " " & PointList.Item(intloop).D_value.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Nominal.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).USL.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).LSL.ToString("0.000").PadLeft(10, " "c))

Open in new window

cmdolcetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
You can use many of the string functions such as String.IsNullOrEmpty or String.Contains etc
0
Carlos VillegasFull Stack .NET DeveloperCommented:
_partfile.PartfileData(intloop).FeatureComment.Trim() ???
0
Jacques Bourgeois (James Burger)PresidentCommented:
Assuming that FeatureComment is a String:

Add the following before your code:
Dim featureComment As String
If _partfile.PartfileData(intloop).FeatureComment.Length>0 then
    featureComment = " " & "-" & " " & _partfile.PartfileData(intloop).FeatureComment
EndIf

Open in new window

Then change your code to use the featureComment variable instead of what you have actually:

objStreamWriter.WriteLine(_partfile.PartfileData(intloop).FeatureName.PadRight(10, " "c) & " " & "-" & " " & _partfile.PartfileData(intloop).FeatureType.PadRight(5, " "c) & featureComment)
                        objStreamWriter.WriteLine(_partfile.PartfileData(intloop).FeatureName.PadRight(10, " "c) & " " & "X" & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).X.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "Y" & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).Y.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "Z" & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).Z.ToString("0.000").PadLeft(10, " "c))
                        objStreamWriter.WriteLine("          " & " " & "D" & " " & PointList.Item(intloop).D_value.ToString("0.000").PadLeft(11, " "c) & _partfile.PartfileData(intloop).Nominal.ToString("0.000").PadLeft(11, " "c) & " " & _partfile.PartfileData(intloop).USL.ToString("0.000").PadLeft(10, " "c) & " " & _partfile.PartfileData(intloop).LSL.ToString("0.000").PadLeft(10, " "c))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.