Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Convert VB to VB Script
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

caser85
Starting Member

21 Posts

Posted - 22 March 2001 :  19:42:43  Show Profile
Ok I'm trying to use some VB but I want to convert it to VB Script to use within my ASP pages. Does anybody know how to convert this VB below? Or can you give me tips?? THank you very much.
-------------------------------------------

Option Explicit

' environmental information...
Private m_dbstring As String
Private m_userid As Long

' single-instance objects...
Private m_DB As db
Private m_People As people
Private m_Jobs As Jobs
Private m_FreeText As FreeText
Private m_Skills As Skills
Private m_Notifications As Notifications

' Startup - gives environmental information to the object...
Public Function Startup(ByVal DBString As String, ByVal UserID As Long)

' store the data...
m_dbstring = DBString
m_userid = UserID

End Function

' Shutdown - clear everything up when we're done...
Public Function Shutdown()

' clear the single-instance objects...
If Not m_DB Is Nothing Then
m_DB.Shutdown
Set m_DB = Nothing
End If
If Not m_People Is Nothing Then
m_People.Shutdown
Set m_People = Nothing
End If
If Not m_Jobs Is Nothing Then
m_Jobs.Shutdown
Set m_Jobs = Nothing
End If
If Not m_FreeText Is Nothing Then
m_FreeText.Shutdown
Set m_FreeText = Nothing
End If
If Not m_Skills Is Nothing Then
m_Skills.Shutdown
Set m_Skills = Nothing
End If
If Not m_Notifications Is Nothing Then
m_Notifications.Shutdown
Set m_Notifications = Nothing
End If

End Function

' Terminate - in case shutdown is not called...
Private Sub Class_Terminate()
Shutdown
End Sub

' DB - return a handle to the DB object...
Public Property Get db() As db

' do we already have one?
If m_DB Is Nothing Then
Set m_DB = New db
m_DB.Startup m_dbstring
End If

' return the connection...
Set db = m_DB

End Property

' People - return a handle to the People object...
Public Property Get people() As people

' do we already have one?
If m_People Is Nothing Then
Set m_People = New people
m_People.Startup Me
End If

' return the connection...
Set people = m_People

End Property

' Jobs - return a handle to the Jobs object...
Public Property Get Jobs() As Jobs

' do we already have one?
If m_Jobs Is Nothing Then
Set m_Jobs = New Jobs
m_Jobs.Startup Me
End If

' return the connection...
Set Jobs = m_Jobs

End Property

' FreeText - return a handle to the FreeText object...
Public Property Get FreeText() As FreeText

' do we already have one?
If m_FreeText Is Nothing Then
Set m_FreeText = New FreeText
m_FreeText.Startup Me
End If

' return the connection...
Set FreeText = m_FreeText

End Property

' Skills - return a handle to the Skills object...
Public Property Get Skills() As Skills

' do we already have one?
If m_Skills Is Nothing Then
Set m_Skills = New Skills
m_Skills.Startup Me
End If

' return the connection...
Set Skills = m_Skills

End Property

' Notifications - return a handle to the Notifications object...
Public Property Get Notifications() As Notifications

' do we already have one?
If m_Notifications Is Nothing Then
Set m_Notifications = New Notifications
m_Notifications.Startup Me
End If

' return the connection...
Set Notifications = m_Notifications

End Property

' IsLoggedOn - do we have a user?
Public Function IsLoggedOn() As Boolean
If m_userid = 0 Then
IsLoggedOn = False
Else
IsLoggedOn = True
End If
End Function

' UserID - returns the user ID...
Public Property Get UserID() As Long
UserID = m_userid
End Property

Public Property Let UserID(ByVal NewVal As Long)
m_userid = NewVal
End Property

' User - returns a logged on user, if there is one...
Public Property Get User() As Person

' are we logged on?
If IsLoggedOn = True Then
Set User = people.CreateEntity(UserID)
End If

End Property

--------------------------------------------

Please advise! I don't need actual code. But just tips for what part correlates to what in VB Script...
Thanks


Doug G
Support Moderator

USA
6493 Posts

Posted - 22 March 2001 :  22:36:25  Show Profile
Visit msdn.microsoft.com/scripting, navigate to the VBScript language reference, and search for 'class' to find out about VBS classes. The information is skimpy but should be enough since you already are used to classes.

Conceptually, keep in mind the stateless nature of the web vs. the always-on nature of a local VB application.


======
Doug G
======
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07