Solved

Cast from string " " to type 'Double' is not valid...........Trying to convert a string to a boolean value

Posted on 2004-09-08
3
408 Views
Last Modified: 2012-08-14
I am reading a flat text file with a field that has a blank.  I need to covert the string to a boolean value.  

Here is the error message

An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Cast from string " " to type 'Double' is not valid.


Here is the code

Dim tmip As String
tmip = Mid(strLine, 152, 1)

If tmip = 0 Or "" Then
                tmip = False
            Else
                tmip = True
End If

The actual value when you look at the variable is a ""

Any help is greatly appreciated.

Thanks
Kenny



0
Comment
Question by:kwh3856
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
ID: 12007124
Try this...

Dim tmip As String
if tmip.substring(152, 1).tostring = "" elseor tmip.substring(152, 1).tostring = 0 then
  tmip = false
Else
  tmip = true
End If
0
 

Author Comment

by:kwh3856
ID: 12007248
Thanks for the help.


Kenny
0
 
LVL 27

Expert Comment

by:planocz
ID: 12007313
glad to help, just call any time. :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now