Ken Patrick - Visual Basic .Net Code Samples

Webservice call to an Oracle stored Procedure returning a Dataset (VB.NET)

<WebMethod(Description:="Returns a Dataset with all Relations", cacheduration:=5)> _
Public Function ReturnRelDS(ByVal account As String) As DataSet
'KP 2005-0092 replace the Existing webservice with stored procedures
'get Relations Info from Oracle through a Stored Procedure
Dim glb As Global
Dim sql As String
Dim cmd As New OracleCommand
glb = Context.ApplicationInstance
Dim oc As New OracleClient.OracleConnection(glb.OrcCS)
oc.Open()
sql = "ATLASWS.sp_ALL_REL_DS"
Dim DA As New OracleDataAdapter(sql, oc)
DA.SelectCommand.CommandType = CommandType.StoredProcedure
DA.SelectCommand.Parameters.Add(New OracleParameter("ACCTNO",
OracleType.VarChar, 20)).Value = Trim(account)
DA.SelectCommand.Parameters.Add("IO_CURSOR", OracleType.Cursor)
.Direction = ParameterDirection.Output
Dim ds As New DataSet("Relations")
DA.Fill(ds)
oc.Close()
Return ds
End Function


Convert EAN (European Article Number) to ISBN (International Standard
Book Number) Function (VB.NET)

Public Function EAN_TO_ISBN(ByVal Raw_Barcode As String) As String
'Input...EAN-13,EAN-18(Bookland)
Select Case Len(Raw_Barcode)
Case 13, 19 'Bookland EAN With or Without Price Barcode / with checkdigit
Dim ISBN_WO_Checkdigit As String
Dim X As Integer
Dim Y As Integer
Dim Running_Total As Integer
Dim Single_digit_of_ISBN As Integer
Dim Final_ISBN As String

ISBN_WO_Checkdigit = Mid(Raw_Barcode, 4, 10)
X = 10
Y = 1
Do While X > 1
Running_Total = Running_Total + (CInt(Mid(ISBN_WO_Checkdigit, Y, 1) * X))
X = X - 1
Y = Y + 1
Loop
Running_Total = Running_Total Mod 11
Running_Total = 11 - Running_Total

Select Case Running_Total
Case 10
Final_Isbn = Mid(Raw_Barcode, 4, 9) & "X"
Case 11
Final_Isbn = Mid(Raw_Barcode, 4, 9) & "0"
Case Else
Final_Isbn = Mid(Raw_Barcode, 4, 9) & Running_Total
End Select

Return Final_Isbn

Case 12, 18 'Bookland EAN With or Without Price Barcode No EAN check digit
Dim ISBN_WO_Checkdigit As String
Dim X As Integer
Dim Y As Integer
Dim Running_Total As Integer
Dim Single_digit_of_ISBN As Integer
Dim Final_ISBN As String

ISBN_WO_Checkdigit = Mid(Raw_Barcode, 4, 9)
X = 10
Y = 1
Do While X > 1
Running_Total = Running_Total + (CInt(Mid(ISBN_WO_Checkdigit, Y, 1) * X))
X = X - 1
Y = Y + 1
Loop
Running_Total = Running_Total Mod 11
Running_Total = 11 - Running_Total

Select Case Running_Total
Case 10
Final_Isbn = Mid(Raw_Barcode, 4, 9) & "X"
Case 11
Final_Isbn = Mid(Raw_Barcode, 4, 9) & "0"
Case Else
Final_Isbn = Mid(Raw_Barcode, 4, 9) & Running_Total
End Select

Return Final_Isbn

Case 10 'Standard ISBN no conversion
Dim Final_Isbn = Raw_Barcode
Return (Final_Isbn)
End Select

End Function



Function To Validate the CMS National Provider Information number (NPI)
by calculating it's checksum and passing back
a boolean (VB.NET)

Private Function ValidateNPI(ByVal sNPI As String) As Boolean
'KP calculate the Checksum of an NPI using the Luhn Algorithm
'This can easily be modified to return a checksum instead of a boolean '1/17/2007.
Dim I As Integer
Dim iCnst80840Prefix As Integer = 24
Dim iRoutine1 As Integer 'Add the 80840 prefix along with the literal even digits
Dim dRoutine2 As Double
Dim dRoutine3 As Double
Dim dRoutineResult As Double
Dim dRoutineCeiling As Double
Dim dFinalResult As Double

Try
'example NPI without check sum is "123456789", The checksum is 3
'KJP add the even digits (From the left: 2,4,6,8) and the "80840" Prefix value.
'This returns the first value.
iRoutine1 = iCnst80840Prefix + CInt(Mid(sNPI, 8, 1)) + CInt(Mid(sNPI, 6, 1))
+ CInt(Mid(sNPI, 4, 1)) + CInt(Mid(sNPI, 2, 1))


'KJP Loop through the odd digits(From the left: 1,3,5,7,9),
'multiply by 2 and add the numbers (not the SUM) together
'This returns the second value.
I = 1
Do Until I > 9
Dim sMidRslt As String
Dim dMidRslt As Double
Dim dMidRslt1 As Double
dMidRslt = Val(Mid(sNPI, I, 1)) * 2
sMidRslt = dMidRslt.ToString
dMidRslt1 = CDbl(Val(Mid(sMidRslt, 1, 1))) + CDbl(Val(Mid(sMidRslt, 2, 1)))
dRoutine2 = dRoutine2 + dMidRslt1
I += 2
Loop

'KJP add up and calculate all of the individual pieces
dRoutine3 = iRoutine1 + dRoutine2
dRoutineCeiling = (Val(Mid(dRoutine3.ToString, 1, 1)) * 10) + 10
dFinalResult = dRoutineCeiling - dRoutine3

'KJP result may be 10 so trim it down to the checksum of 0
If dFinalResult = 10 Then
dFinalResult = 0
End If
'KJP Do the final comparison
If CStr(dFinalResult) = Mid(sNPI, 10, 1) Then
Return True
Else
Return False
End If

Catch ex As Exception
Logger.Trace(SeverityLevel.CriticalError, ex)
Return False
End Try

End Function



Webservice call to an Oracle stored Procedure to do an Update (VB.NET)

<WebMethod(Description:="Allows a quick and simple update to a Relation record
through an Oracle Stored Procedure", cacheduration:=10)> 'KJP 2005
Public Function SimpleRelUpdateSP(ByVal account As String, ByVal Rel_Pos As String,
ByVal Address1 As String, ByVal Address2 As String, ByVal City As String,
ByVal State As String, ByVal Zip As String, ByVal Phone_Home As String,
ByVal Phone_Work As String, ByVal Phone_Other As String,
ByVal Update_ID As String) As Boolean

Try
Dim sql As String
Dim glb As Global
glb = Context.ApplicationInstance
Dim oc As New OracleClient.OracleConnection(glb.OrcCS)
oc.Open()
Dim orcm As New OracleCommand
Dim OracleCom As New OracleCommand
Dim strSQL As String
strSQL = "ATLASWS.sp_INSERT_RELHIST"
orcm = New OracleCommand(strSQL, oc)
orcm.CommandType = CommandType.StoredProcedure
orcm.Parameters.Add("acctno", OracleType.VarChar).Value = account.Trim
orcm.Parameters.Add("relpos", OracleType.VarChar).Value = Rel_Pos.Trim
orcm.ExecuteNonQuery()
orcm.Parameters.Clear()
oc.Close()
Dim ku As Integer = 0
oc.Open()

If Left(Update_ID, 3) = "PRK" Or Left(Update_ID, 3) = "MAK" Then ku = 36000
strSQL = "ATLASWS.sp_SMPLE_REL_UP"
OracleCom = New OracleCommand(strSQL, oc)
OracleCom.CommandType = CommandType.StoredProcedure
OracleCom.Parameters.Add(New OracleParameter("v_account", OracleType.VarChar))
.Value = account
OracleCom.Parameters.Add(New OracleParameter("v_rel_pos", OracleType.VarChar))
.Value = Rel_Pos
OracleCom.Parameters.Add(New OracleParameter("v_ku", OracleType.Number))
.Value = ku
OracleCom.Parameters.Add(New OracleParameter("v_add1", OracleType.VarChar))
.Value = Address1
OracleCom.Parameters.Add(New OracleParameter("v_add2", OracleType.VarChar))
.Value = Address2
OracleCom.Parameters.Add(New OracleParameter("v_city", OracleType.VarChar))
.Value = City
OracleCom.Parameters.Add(New OracleParameter("v_state", OracleType.VarChar))
.Value = State
OracleCom.Parameters.Add(New OracleParameter("v_zip", OracleType.VarChar))
.Value = Zip
OracleCom.Parameters.Add(New OracleParameter("v_phnh", OracleType.VarChar))
.Value = Phone_Home
OracleCom.Parameters.Add(New OracleParameter("v_phnw", OracleType.VarChar))
.Value = Phone_Work
OracleCom.Parameters.Add(New OracleParameter("v_phno", OracleType.VarChar))
.Value = Phone_Other
OracleCom.Parameters.Add(New OracleParameter("v_updateid", OracleType.VarChar))
.Value = Update_ID
OracleCom.Parameters.Add(New OracleParameter("succ", OracleType.Number))
OracleCom.Parameters("succ").Direction = ParameterDirection.Output

OracleCom.CommandText = strSQL
OracleCom.ExecuteNonQuery()
oc.Close()

Return True

Catch ex As Exception
     Return False
     End Try
End Function



Webservice Call to LexisNexis® Banko® which
offer Bankruptcy and National Deceased database access (VB.NET)

Imports System.Configuration
Imports System.Web.Services
Imports System.Xml
Imports System.Xml.XPath
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices

<System.Web.Services.WebService(Namespace:="http://BANKO_WEBSERVICE/BKWS")> _
Public Class BKWS

Inherits System.Web.Services.WebService
Private str_User As String = ConfigurationSettings.AppSettings("YOURUSERNAME")
Private str_PWD As String = ConfigurationSettings.AppSettings("YOURPASSWORD")

<WebMethod(Description:="Gets Returns an XML document contains browse nodes with records the
loosely match the search criteria using the SSN, NAME, CITY, STATE")>
'KJP 2005
Public Function BrowseBKRecords(ByVal BKName As String, ByVal BKSSN As String, ByVal
BKCITY As String, ByVal BKState As String) As String
'Just browse the records returns an XML document containing up to 250 docs
Try
Dim xmldoc As New Xml.XmlDocument
Dim myrequest As HttpWebRequest
Dim myResponse As WebResponse
Dim my_Last As String = ftn_GET_NAME_PORTION(BKName, "LAST")
Dim my_FIRST As String = ftn_GET_NAME_PORTION(BKName, "FIRST")
Dim MY_SSN As String = ftn_STRIP_SSN(BKSSN)
Dim My_Browse_link As String
Dim My_Detail_link As String

If MY_SSN = "INVALIDSSN" Then
'Search With Name, City, State
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" &
str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&FirstName=" & my_FIRST &
"&LastName=" & my_Last & "&CITY=" & BKCITY & "&STATE=" & BKState
Else
'Search With SSN & Name
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" &
str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&SocialSecurityNumber=" &
MY_SSN & "&FirstName" & my_FIRST & "&LastName=" & my_Last
End If

myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
Dim ReceiveStream As Stream = myResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(ReceiveStream, encode)
xmldoc.Load(readStream)

BrowseBKRecords = xmldoc.InnerXml

myrequest = Nothing
myResponse.Close()
myResponse = Nothing
readStream.Close()
readStream = Nothing
xmldoc = Nothing

Catch ex As Exception
Dim My_sampan As String = "This will not Float"
End Try
End Function

<WebMethod(Description:="Returns an XML document using Name, SSN, CITY, and STATE: 55% hit rate")>
'KJP 2005
Public Function GetSINGLEBKRECORD1(ByVal BKName As String, ByVal BKSSN As String,
ByVal BKCITY As String, ByVal BKState As String) As String

'Does a webservice BANKO Lookup
'logic as follows
'Return "1" if 0 records found
'Return The detail record if 1 record found
'If More than one record was returned in the browse...tack on the city and state to see if it'll
'narrow it down to 1 record...If it does Return the detail record
'Returns "0" if the WS error's out

'Errors
'0-No records returned
'1-Multiple Records returned
'2-Record returned did not match the SSN we plugged in.
'"Error" Internal Webservice error


Try
Dim my_Last As String = ftn_GET_NAME_PORTION(BKName, "LAST")
Dim my_FIRST As String = ftn_GET_NAME_PORTION(BKName, "FIRST")
Dim MY_SSN As String = ftn_STRIP_SSN(BKSSN)
Dim My_Browse_link As String
Dim My_Detail_link As String
Dim myrequest As HttpWebRequest
Dim myResponse As WebResponse
Dim xmlSearch As New Xml.XmlDocument
Dim xmlDetail As New Xml.XmlDocument
Dim Dolan_ID As String
Dim Returned_SSN As String
Dim Rec_ID As String

If MY_SSN = "INVALIDSSN" Then
'Search With Name, City, State
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" & str_User &
"&Password=" & str_PWD & "&ProductCode=Bankruptcy&FirstName=" & my_FIRST & "&LastName="
& my_Last & "&CITY=" & BKCITY & "&STATE=" & BKState
Else
'Search With SSN & Name
'My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" &
str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&SocialSecurityNumber=" & MY_SSN
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" &
str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&SocialSecurityNumber=" &
MY_SSN & "&FirstName" & my_FIRST & "&LastName=" & my_Last
End If

myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
Dim ReceiveStream As Stream = myResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(ReceiveStream, encode)
xmlSearch.Load(readStream)

Select Case xmlSearch.SelectNodes("//RecordId").Count

Case 0 'mea'ole
GetSINGLEBKRECORD1 = "0"
Case 1 'Maika'i

Rec_ID = xmlSearch.SelectSingleNode("//RecordId").InnerText
Dolan_ID = xmlSearch.SelectSingleNode("//DolanControlId").InnerText

'Grab the detail Record
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" &
str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&DolanControlId="
& Dolan_ID & "&RecordId=" & Rec_ID
myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
ReceiveStream = myResponse.GetResponseStream()
encode = System.Text.Encoding.GetEncoding("utf-8")
readStream = New StreamReader(ReceiveStream, encode)
xmlDetail.Load(readStream)
'Validate the record...I.E. the SSN and NAME Match
Returned_SSN = Mid(xmlDetail.SelectSingleNode("//SocialSecurityNumber").InnerText, 8, 4)
If Returned_SSN = Mid(BKSSN, 6, 4) Then
GetSINGLEBKRECORD1 = xmlDetail.OuterXml
Else
GetSINGLEBKRECORD1 = "2"
End If

Case Is > 1 'la'iki
GetSINGLEBKRECORD1 = xmlSearch.SelectNodes("//RecordId").Count.ToString & " Records"

'Don't bother re-browsing...the SSN is no good...
'It's never going to refine the search enough if we're not using the correct SSN
If MY_SSN = "INVALIDSSN" Then
GetSINGLEBKRECORD1 = "1"
End If

My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username="
& str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&SocialSecurityNumber="
& MY_SSN & "&FirstName" & my_FIRST & "&LastName=" & my_Last & "&CITY=" & BKCITY
& "&STATE=" & BKState
myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
ReceiveStream = myResponse.GetResponseStream()
readStream = New StreamReader(ReceiveStream, encode)
xmlSearch.Load(readStream)

Dim My_Count As Integer = xmlSearch.SelectNodes("//RecordId").Count()
If My_Count = 1 Then 'Maika'i
Rec_ID = xmlSearch.SelectSingleNode("//RecordId").InnerText
Dolan_ID = xmlSearch.SelectSingleNode("//DolanControlId").InnerText
'Grab the detail Record
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username="
& str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&DolanControlId="
& Dolan_ID & "&RecordId=" & Rec_ID
myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
ReceiveStream = myResponse.GetResponseStream()
encode = System.Text.Encoding.GetEncoding("utf-8")
readStream = New StreamReader(ReceiveStream, encode)
xmlDetail.Load(readStream)

'Make sure that the Records' SSN's match
Returned_SSN = Mid(xmlDetail.SelectSingleNode("//SocialSecurityNumber")
.InnerText, 8, 4)
If Returned_SSN = Mid(BKSSN, 6, 4) Then
GetSINGLEBKRECORD1 = xmlDetail.OuterXml
Else
GetSINGLEBKRECORD1 = "2"
End If

GetSINGLEBKRECORD1 = xmlDetail.OuterXml
End If
GetSINGLEBKRECORD1 = "1"
End Select

myrequest = Nothing
myResponse.Close()
myResponse = Nothing
readStream.Close()
readStream = Nothing
xmlSearch = Nothing
xmlDetail = Nothing

Catch ex As Exception
Dim My_sampan As String = "0"
GetSINGLEBKRECORD1 = "Error"

Finally
End Try
End Function

<WebMethod(Description:="Returns an XML document containing Bankruptcy data using Case Number and State 70% hit rate")>
'KJP 2005
Public Function GetSINGLEBKRECORD2(ByVal BKCasenum As String, ByVal strState As String,
ByVal strSSN As String) As String

'Does a webservice BANKO Lookup
'logic as follows
''Find the Record by just using case number as all other methods have failed

'Errors
'0-No records returned
'1-Multiple Records returned
'2-Record returned did not match the SSN we plugged in.
'"Error" Internal Webservice error

Try

Dim My_Browse_link As String
Dim My_Detail_link As String
Dim myrequest As HttpWebRequest
Dim myResponse As WebResponse
Dim xmlSearch As New Xml.XmlDocument
Dim xmlDetail As New Xml.XmlDocument
Dim Dolan_ID As String
Dim Returned_SSN As String
Dim Rec_ID As String

My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username=" & str_User
& "&Password=" & str_PWD & "&ProductCode=Bankruptcy&CaseNumber=" &
BKCasenum & "&state=" & strState

myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
Dim ReceiveStream As Stream = myResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(ReceiveStream, encode)
xmlSearch.Load(readStream)

Select Case xmlSearch.SelectNodes("//RecordId").Count

Case 0 'mea'ole
GetSINGLEBKRECORD2 = "0"

Case 1 'Maika'i

Rec_ID = xmlSearch.SelectSingleNode("//RecordId").InnerText
Dolan_ID = xmlSearch.SelectSingleNode("//DolanControlId").InnerText

'Grab the detail Record
My_Browse_link = "https:\\www.banko.com/XML_Products\Main.cfm?Username="
& str_User & "&Password=" & str_PWD & "&ProductCode=Bankruptcy&DolanControlId="
& Dolan_ID
& "&RecordId=" & Rec_ID
myrequest = myrequest.Create(My_Browse_link)
myResponse = myrequest.GetResponse()
ReceiveStream = myResponse.GetResponseStream()
encode = System.Text.Encoding.GetEncoding("utf-8")
readStream = New StreamReader(ReceiveStream, encode)
xmlDetail.Load(readStream)
'Validate the record...I.E. the SSN and NAME Match
GetSINGLEBKRECORD2 = xmlDetail.InnerXml

'Make sure that the Records' SSN's match
Returned_SSN = Mid(xmlDetail.SelectSingleNode("//SocialSecurityNumber").
InnerText, 8, 4)
If Returned_SSN = Mid(strSSN, 6, 4) Then
GetSINGLEBKRECORD2 = xmlDetail.OuterXml
Else
GetSINGLEBKRECORD2 = "2"
End If

Case Is > 1
GetSINGLEBKRECORD2 = "1"
End Select

myrequest = Nothing
myResponse.Close()
myResponse = Nothing
readStream.Close()
readStream = Nothing
xmlSearch = Nothing
xmlDetail = Nothing

Catch ex As Exception
Dim My_sampan As String = "0"
GetSINGLEBKRECORD2 = "Error"

Finally

End Try

End Function


String Manipulation to pull a specified portion of full name (VB.NET)


Public Function ftn_GET_NAME_PORTION(ByVal Name As String, ByVal Name_Portion As String) As String
'KJP 2005
Name = Replace(Name.ToUpper, ".", " ") & " "
Dim FN As String
Dim MN As String
Dim LN As String
Dim TN As String

If InStr(Name, ";") Then
LN = Microsoft.VisualBasic.Left(Name, InStr(Name, ";") - 1).Trim()
TN = Name.Substring(InStr(Name, ";")).Trim
FN = TN.Substring(0, InStrRev(TN, " ")).Trim
MN = TN.Substring(InStrRev(TN, " ")).Trim
If FN = "" Then FN = MN : MN = ""
Else
LN = Name.Trim
End If

Select Case Name_Portion
Case "FIRST"
Return FN
Case "MIDDLE"
Return MN
Case "LAST"
LN = Replace(LN, "SR", "")
LN = Replace(LN, "JR", "")
LN = Replace(LN, "III", "")

Return LN
End Select

End Function



String Manipulation to remove dashes and underscores from an SSN (VB.NET)
Public Function ftn_STRIP_SSN(ByVal SSN As String) As String
SSN = Trim(SSN)
SSN = Replace(SSN, "-", "")
SSN = Replace(SSN, "_", "")

If Len(SSN) = 9 And SSN <> "000000000" Then
Return SSN
Else
Return "INVALIDSSN"
End If
End Function



Present Web Content on a specified date (in this case hyperlinks), date stored in the Web.config file  (VB.NET)

Private Sub ShowPlansAvailable()

'From the Web.Config File
'<add key="LINKMonth" value="7" />
'<add key="LINKDay" value="1" />
'<add key="LINKYear" value="2008" />

Try
Dim iPlanCount As Integer = 0
Me.pnlError.Visible = False
Me.pnlSearchResults.Visible = True

Dim dtNow As DateTime = DateTime.Now
Dim dtNewPlanDate As DateTime

Try
Dim intMonth As Integer = CInt(System.Configuration.ConfigurationManager.AppSettings("LINKMonth"))
Dim intDay As Integer = CInt(System.Configuration.ConfigurationManager.AppSettings("LINKDay"))
Dim intYear As Integer = CInt(System.Configuration.ConfigurationManager.AppSettings("LINKYear"))
dtNewPlanDate = New DateTime(intYear, intMonth, intDay)
Catch ex As Exception
'Default the date in case the keys weren't added to the Web.Config file
dtNewPlanDate = New DateTime(2008, 7, 1)
End Try

'TODO: Change the hyperlink url's
'If the date is greater than 07/01/2008 00:00 then use these new links
If dtNow >= dtNewPlanDate Then
'it's after 07/01/2008 00:00, New Plan date
'turn off the old hyperlinks
Me.hypDirectHMO.Enabled = False
Me.hypSelectHMO.Enabled = False
Me.hypDirectPOS.Enabled = False
Me.hypSelectPOS.Enabled = False
Me.hypPPO.Enabled = False
Me.hypDirectHMO.Visible = False
Me.hypSelectHMO.Visible = False
Me.hypDirectPOS.Visible = False
Me.hypSelectPOS.Visible = False
Me.hypPPO.Visible = False

'PPO's (All 3)
If oZipSearch.PPO = True Then
iPlanCount = iPlanCount + 3
Me.hypNEWPPO1.Enabled = True
Me.hypNEWPPO1.Visible = True
Me.hypNEWPPO2.Enabled = True
Me.hypNEWPPO2.Visible = True
Me.hypNEWPPO3.Enabled = True
Me.hypNEWPPO3.Visible = True
Else
Me.hypNEWPPO1.Enabled = False
Me.hypNEWPPO1.Visible = False
Me.hypNEWPPO2.Enabled = False
Me.hypNEWPPO2.Visible = False
Me.hypNEWPPO3.Enabled = False
Me.hypNEWPPO3.Visible = False
End If

'HMO
If oZipSearch.HMODirect = True Then
iPlanCount = iPlanCount + 1
Me.hypNEWHMO.Enabled = True
Me.hypNEWHMO.Visible = True
Else
Me.hypNEWHMO.Enabled = False
Me.hypNEWHMO.Visible = False
End If

Else
'it's before 07/01/2008 00:00
'using the orig. logic
'it's before D-day turn off the new links

If oZipSearch.HMODirect = True Then
Me.hypDirectHMO.Enabled = True
Me.hypDirectHMO.Visible = True

Else
Me.hypDirectHMO.Enabled = False
Me.hypDirectHMO.Visible = False
End If

If oZipSearch.HMOSelect = True Then
Me.hypSelectHMO.Enabled = True
Me.hypSelectHMO.Visible = True

Else
Me.hypSelectHMO.Enabled = False
Me.hypSelectHMO.Visible = False
End If

If oZipSearch.POSDirect = True Then
Me.hypDirectPOS.Enabled = True
Me.hypDirectPOS.Visible = True
Else
Me.hypDirectPOS.Enabled = False
Me.hypDirectPOS.Visible = False
End If
If oZipSearch.POSSelect = True Then
Me.hypSelectPOS.Enabled = True
Me.hypSelectPOS.Visible = True
Else
Me.hypSelectPOS.Enabled = False
Me.hypSelectPOS.Visible = False
End If
If oZipSearch.PPO = True Then
Me.hypPPO.Enabled = True
Me.hypPPO.Visible = True
Else
Me.hypPPO.Enabled = False
Me.hypPPO.Visible = False
End If

End If

Catch ex As Exception

Finally

End Try
Code Samples
VB 6 VB.Net PL/SQL C#
Social Bookmarks        Copyright © by Kenneth Patrick 2000 - 2008      Host your .Net Website with Brinkster.