can any one spot any thing wrong with this code

ident
06-08-2005, 05:58 PM
hi, i dont get any errors or anything. its just the source code dont fully display in txtsource (it stops at the <head> tag


'********************************************************************* **
'Coded by: Sam
'Sonar
'********************************************************************* ******

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Enum eAvailability
online = 0
Offline = 1
NotAvailable = 2
End Enum

Dim UserAvailable As eAvailability

Private Sub btnGet_Click()
On Error Resume Next

'Enable timers
tmr1.Enabled = True
tmr2.Enabled = True

Dim UserName
UserName = "http://www.squatjuice.com/cgi-bin/yabb/YaBB.pl?action=viewprofile;username=" & cboAddress.Text
If cboAddress = "" Then Exit Sub
brwsMain.Navigate UserName
UserAvailable = IsUserOnline(txtSource)
If UserAvailable = online Then
MsgBox ("User Online")
End If
If UserAvailable = Offline Then
MsgBox ("User Offline")
End If
End Sub

'********************************************************************* ***
'Create enumeration for availability.

Private Function IsUserOnline(sSourceText As String) As eAvailability
Dim lOnPos As Long
Dim lOffPos As Long
'Initialize the positions.
lOnPos = 1
lOffPos = 1

'Check if online.
lOnPos = InStr(1, sSourceText, "<i>online</i>", vbTextCompare)
If lOnPos Then
IsUserOnline = online
Exit Function
End If

'Check if offline.
lOffPos = InStr(1, sSourceText, "<i>offline</i>", vbTextCompare)
If lOffPos Then
IsUserOnline = Offline
Exit Function
End If

'If here, no information was found.
IsUserOnline = NotAvailable

End Function
'********************************************************************* ***


Private Sub Command1_Click()
UserAvailable = IsUserOnline(txtSource)
If UserAvailable = online Then
MsgBox ("User Online")
End If
If UserAvailable = Offline Then
MsgBox ("User Offline")
End If
End Sub

Private Sub tmr2_Timer()
'Display source code
txtSource = brwsMain.Document.documentElement.innerHTML
End Sub

Private Sub tmr1_Timer()
If brwsMain.Busy = False Then
trm1.Enabled = False
Me.Caption = Sonar - Loaded
Else
Me.Caption = "Sonar - Loading..."
End If
End Sub


this is my entire code. does any one understand why it stops at <head>?

also if possible as you can see i use two buttons.

btnGet_Click() and Command1_Click()

i use btnGet to get the source and thenthe other button to look through the source. if possible i would like to be able to just use one button to do it all. any help there?

thanks in advance

Shurik12
06-08-2005, 06:04 PM
Hi,

Try to drop on Error Resume Next, add the error handler and step through the code (F8)

Shurik.

ident
06-09-2005, 05:57 PM
Hi,

Try to drop on Error Resume Next, add the error handler and step through the code (F8)

Shurik.

no luck

Diurnal
06-09-2005, 06:22 PM
I couldn't see the forest through the trees... Try setting the .Multiline property of the textbox to True in the designer window. You should probably set the .Scrollbars property to 2 (vertical).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum