TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
vb.net need to convert string to integer
Aug 2 2019 10:56 AM
In a vb.net 2012 application I have the following code that works:
Protected _schoolyear As Integer
Protected _schoolyearcheck As String
If (IsDBNull(_schoolyearcheck)) Or (Not IsNumeric(_schoolyearcheck)) Or CInt(_schoolyearcheck < 2000) Or (CInt(_schoolyearcheck) = _schoolyear) Then
_schoolyear = _schoolyear
ElseIf CInt(_schoolyearcheck) + 1 = _schoolyear Then
_schoolyear = CInt(_schoolyearcheck)
End If
However I am wondering about the _schoolyearcheck field. I have a funciton call to the sql server database that really returns an integer value. However I
am concerned that the call may return a null or something that is not numeric. That is why I am using a string value. Due to that fact I am converting the
string to an interger in the the code Above. Thus can you show me code that would be better to use than converting all the values listed above?
Reply
Answers (
1
)
Lamba experssion with Groupby Related Data Problems
How to add an event to a static method in a class?