Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to convert fallowing vb.net code to c#.I used telerik converter to convert it but the fallowing converted code lines are not working...

VB
private long m_lngMinValue = 0 - 9.22337203685478E+18;
       
      Private m_lngMinValue As Long = 0 - 9.2233720368547758E+18#
      Private m_curMaxValue As Decimal = 922337203685477.62
      Private m_curMinValue As Decimal = 0 - 922337203685477.62 
      Private m_intMinValue As Integer = 0 - 2147483648// 


& Converted code is as follows but it is giving error..

C#
private long m_lngMinValue = 0 - 9.22337203685478E+18;// cannot convert double to long
private decimal m_curMaxValue = 922337203685478.0;// solved by replacing 922337203685478.0 by 922337203685478.0M
private decimal m_curMinValue = 0 - 922337203685478.0;//can not convert double to decimal
private int m_intMinValue = 0 - 2147483648L;// can not convert uint to int
Posted
Updated 3-Feb-14 19:27pm
v2
Comments
Abhinav S 4-Feb-14 1:16am    
what error?
V5709 4-Feb-14 1:27am    
please check question again, i updated it with errors..

C#
private long m_lngMinValue = 0 - 9.22337203685478E+18;
private long m_lngMinValue = 0 - 9.22337203685478E+18;
private decimal m_curMaxValue = 922337203685478.0;
private decimal m_curMinValue = 0 - 922337203685478.0;
private int m_intMinValue = 0 - 2147483648L;





VB
Dim vIn As Double = 0.0
Dim vOut As Decimal = Convert.ToDecimal(vIn)


VB
Dim vIn As Double = 0.0
Dim vOut As Long = Convert.ToInt64(vIn)


VB
Dim vIn As UInteger = 0
Dim vOut As Integer = Convert.ToInt32(vIn)



try above 3 conversion
try this link http://www.convertdatatypes.com/Convert-UInteger-to-Integer-in-VB.net.html[^]
 
Share this answer
 
v2
Comments
V5709 4-Feb-14 2:38am    
nop...
Aravindba 4-Feb-14 2:48am    
nop ? in my solution not work ?
V5709 4-Feb-14 4:33am    
no yar.. its not working..
Aravindba 4-Feb-14 4:58am    
hi try above 3 conversion,try to pass that values in my codes,i think u have problem in 1,3 and 4 lines,try my solution link,can get any ideas, my solution updated
V5709 5-Feb-14 0:01am    
hi..Thanks for your reply... I got soln(Solution 2
) which is now working...
You should just copy and paste the original values from the VB code into the C# converted code.

After that in C# code you should put (long) in from of 1st value, (decimal) in front of 3rd value (for conversion the values), and the 4th variable type you should replace its type from "int" to "uint"!
 
Share this answer
 
v2
Comments
V5709 4-Feb-14 1:32am    
Not worked..
Raul Iloc 4-Feb-14 2:53am    
See my update in the 1st solution above!
V5709 4-Feb-14 4:42am    
This is the way by which right now i have done...(see solution 2)...if i want to do it implicitly then is it possible?
I have solved this...
C#
private long m_lngMinValue =(long)(0 - 9.22337203685478);
     private decimal m_curMaxValue = 922337203685478.0m;
     private decimal m_curMinValue = 0 - 922337203685478.0m;
      private int m_intMinValue = (int)(0 - 2147483647);
 
Share this answer
 
C#
Try This
private long m_lngMinValue = 0 - 9.22337203685478E+18;
private decimal m_curMaxValue = 922337203685478.0;
private decimal m_curMinValue = 0 - 922337203685478.0;
private int m_intMinValue = 0 - 2147483648L;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900