Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Cannot Convert String to Type 'Double' is Not Valid in VB.NET

Apr 17, 2015
Introduction:

Here I will explain how to solve the problem of “cannot convert string to type 'Double' is not valid” in vb.net. To solve this problem we need to use ‘& or CStr formats in string while assigning integer values to string in vb.net.

Description:

In previous posts I explained save files in folder and download in asp.net, read or write text file in asp.net, upload and download files from database in asp.net, download multiple files as zip folder in asp.net and many articles relating to solve errors in asp.net, SQL Server, IIS, etc. Now I will explain how to solve the problem of “cannot convert string to type 'Double' is not validin vb.net.

In one application when I tried to concatenate string value with integer values in vb.net  that time I got error like as shown below

Actually in vb.net we need to use ‘&’ or ‘CStr’ operators instead of ‘+’ operator for concatenation. We can follow different type methods to fix this problem in vb.net

Method 1:


lblMsg.Text = "Your Password Wrong you have only " & (3 - attempts) & " attempts"

Method 2:


lblMsg.Text = "Your Password Wrong you have only " + CStr(3 - attempts) + " attempts"

Method 3:


lblMsg.Text = String.Format("Your Password Wrong you have only {0} attempts", (3 - attempts))

I hope it helps you to solve your problem. Happy Coding……

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

1 comments :

website said...

yes, I also often face this problem, but the way you described it, so far brilliant. Keep it Up, we all learning and enhancing on page skills from you.

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.