I have a simple arithmetic to perform in VB.Net, which is as follows;
I've got m_Variable5 of type String = "325" which is passed from another object. The operations are;
m_Variable5 = Convert.ToString(Convert.ToInt32(m_Variable4, InvariantCulture) / 7, InvariantCulture)
m_Variable5 = Convert.ToString(Convert.ToInt32(m_Variable5, InvariantCulture) + 1, InvariantCulture)
m_Variable5 = Convert.ToString(Convert.ToInt32(m_Variable5, InvariantCulture) * 7, InvariantCulture)
On doing these 3 operations, I got a type error on the second one.
Error message says "Input string was not in a correct format."
but the same operations when done using VB conversion functions, works properly;
m_Variable5 = CStr(CInt(m_Variable4) / 7)
m_Variable5 = CStr(CInt(m_Variable5) + 1)
m_Variable5 = CStr(CInt(m_Variable5) * 7)
Can anyone explain why can't I use the first code, which is more destine for .Net platform?
Many thanks