In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the methods of VB.NET transformation are, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.
VB.NET after a long period of development, many users are very familiar with the transformation of VB.NET, here I would like to publish a personal understanding, and discuss with you. VB.NET also has a very useful use of data transformation, that is, you can use the To method directly after a variable or statement. The following table shows the common To type conversion methods:
How to use VB.NET transform form
◆ transfer string ToString ()
◆ numeric value to character ToChar ()
◆ string to lowercase ToLower ()
◆ string to uppercase ToUpper ()
◆ to reduced integer ToInt16 ()
◆ to integer ToInt32 ()
◆ to long integer ToInt64 ()
◆ turn value ToDecimal ()
◆ transfer date ToDateTime ()
◆ to mono-exact number ToSingle ()
◆ to double number ToDouble ()
◆ to Boolean ToBoolean ()
◆ date to simplified date ToShortDateString ()
◆ time to reduced time ToShortTimeString ()
VB.NET 's processing of data is strongly typed, which means that operations can only be performed if the two data types are the same. Suppose we have two variables, the strA string type and the shtB reduced integer type, and specify strA= "100" and shtB=10. If you want to add the value of shtB to the value of strA, executing the shtB=shtB+strA statement directly will result in an error. This is because shtB and strA are not of the same data type. Although the content of strA is 10, it is enclosed in double quotes; all enclosed by double quotation marks are treated as strings. If you want to perform the addition operation, you must convert the strA to a numeric type using the VB.NET transformation morphological function CShort () and then perform the addition calculation. Therefore, the above formula should be changed to shtB=shtB+CShort (strA), which is the correct answer.
Because VB.NET is a strong type, two different types of data must be converted to the same data type first. VB.NET no longer supports automatic type conversion of the old VB. VB.NET provides a number of functions for type conversion:
VB.NET transform morphological function
◆ Cbool Boolean
◆ Cbyte Byte
◆ Cchar Chart
◆ CDate Date
◆ CDbl Double
◆ CDec Decimal
◆ CInt Integer
◆ CLng Long
◆ CObj Object
◆ CShort Short
◆ CSng Single
◆ CStr String
These functions are easy to remember, C means Convert conversion, and then all except Short are abbreviated with the type to be converted.
This is the end of this article on "what are the ways to change the form of VB.NET?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.