how to use Substr in Visual Basic.Net
-
Hi.... I need to know how to use Substr operation inside Visual Basic.Net language program, because I could not found it,could you mind to help me please ? Thank you for your attention and your help in advance Best regards :-D ICE
-
Hi.... I need to know how to use Substr operation inside Visual Basic.Net language program, because I could not found it,could you mind to help me please ? Thank you for your attention and your help in advance Best regards :-D ICE
-
You can try like this. dim xyz as string xyz.substring(startindex) and other overloaded form of this function is xyz.substring(startindex, length)
Hi Soodmonu many thank for your reply I have tried that operation but it doesn't working well, and Now I saw you my simple program as follows dim a as double dim b,c as string a=03.00 b=str(a) c=b,substring(4,2) when I tried to run my program an error message was come, I wanna to show two last character from "a" into my screen and it supposed to be "00" but I could not catch it, could you mind to tell me how to do that ? Thank you ICE
-
Hi Soodmonu many thank for your reply I have tried that operation but it doesn't working well, and Now I saw you my simple program as follows dim a as double dim b,c as string a=03.00 b=str(a) c=b,substring(4,2) when I tried to run my program an error message was come, I wanna to show two last character from "a" into my screen and it supposed to be "00" but I could not catch it, could you mind to tell me how to do that ? Thank you ICE
Here the problem is type casting from double to string. let me explain you.... first of all when u declare a double variable as 03.00, the value stored in variable will be 3.0 and when u type cast it to string, it will store as "3" only. so as you can see there is no fourth character in string, substring does not return anything. now what you can do that is : Dim a, c As String a = "03.00" c = a.Substring(3, 2) here in the substring function index is a zero based index, so you have to pass 3 to get the fourth character. and if you donot want to declare as string in the starting and want to proceed with double only, then find some help on double.tostring() function, i think that function can help it should be like Dim x As Double Dim a, c As String x = 3.0 a = x.ToString("0#.00") c = a.Substring(3, 2) Arpan :-D -- modified at 8:47 Thursday 29th June, 2006
-
Here the problem is type casting from double to string. let me explain you.... first of all when u declare a double variable as 03.00, the value stored in variable will be 3.0 and when u type cast it to string, it will store as "3" only. so as you can see there is no fourth character in string, substring does not return anything. now what you can do that is : Dim a, c As String a = "03.00" c = a.Substring(3, 2) here in the substring function index is a zero based index, so you have to pass 3 to get the fourth character. and if you donot want to declare as string in the starting and want to proceed with double only, then find some help on double.tostring() function, i think that function can help it should be like Dim x As Double Dim a, c As String x = 3.0 a = x.ToString("0#.00") c = a.Substring(3, 2) Arpan :-D -- modified at 8:47 Thursday 29th June, 2006
Hi. Soodmonu I have tried it and thank's it's running well, thank you for your help Best regards :) ICE