In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about the use of type and Samson exception capture, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Custom data type
In order for our custom data type to be used in each sub, let's define it in general, that is, as a global variable.
Case study:
Define a student's data type
Student attributes: student number, name, gender, age
It is recommended to capitalize the first letter of the custom name, and do not use Chinese. The custom name specification will follow the variable naming convention.
Custom data types tend to prefer to be used with arrays
Custom data types are often defined similar to an object.
Note: custom data types, private Private required
Supplementary exception description for exception capture
Use the Err keyword
Err.Description indicates error description
Classroom summary
1. Learn to customize the data type type
2. Points for attention in mastering data types
3. Learn to troubleshoot and catch anomalies
4. Output of abnormal information
The interface of this issue:
Source code for this issue:
Private Type Student
Sno As Long 'student number sname As String' name ssex As String 'gender sage As Integer' age
End Type
Dim stu () As Student
Private Sub Command1_Click ()
ReDim stu (2) As Student
Stu (0). Sno = 1stu (0). Sname = "Tintin" stu (0). Ssex = "male" stu (0). Sage = 10
Stu (1). Sno = 2stu (1). Sname = "Dongdong" stu (1). Ssex = "female" stu (1). Sage = 11
Stu (2). Sno = 3stu (2). Sname = "Xiaogang" stu (2). Ssex = "male" stu (2). Sage = 10MsgBox "student loaded successfully", vbApplicationModal, "notify" End Sub
Private Sub Command2_Click () On Error GoTo catchtry:Dim i%For I = 0 To UBound (stu) Step 1
Print "student number:" & stu (I). Sno _ & "name: & stu (I). Sname _ &" gender: & stu (I). Ssex _ & "Age: & stu (I). Sage
Next iGoTo finallycatch:MsgBox "Please load the students first!" , vbCritical, "message" finally:
End Sub
After reading the above, do you have any further understanding of type usage and Samson exception capture? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.