To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old May 19th, 2007, 10:22 PM   #1
winterslam
Addicted Member
 
Join Date: Sep 02
Posts: 146
winterslam is an unknown quantity at this point (<10)
Object variable or with block variable not set

My program uses only one activeX, which is Ms Interent Control
shdocvw.dll



I tested my program (without using P&D) on 10 computers. The thing is that it runs perfectly on 9 computers. But on the last computer, it gives "object varible not set" error.

I cant seem to locate the line of error.
The error seems to appear while the form is loading...


I then tried P&D. It's even worse. My program didn't work on all the computers, including my computer! The same error...



Code:
Private Sub Form_Load()
On Error GoTo hell
Me.Show

Dim i As Integer


'Set CustomWB = New WBCustomizer
'With CustomWB
     '   .EnableContextMenus = False 'Disable The Menu
     '   .EnableAllAccelerators = True
     '   Set .WebBrowser = WebBrowser1
'End With

'CustomWB.EnableContextMenus = False

lbltemp.Caption = getDesktopPath


Dim Line1 As String
Dim num As String
Dim score As String

fileName = lbltemp.Caption & "\Model School System (" + schooltype + ").dat"



If Dir(fileName) <> "" Then
            Open fileName For Input As #1
                    Do Until EOF(1)
                            Input #1, Line1
                            If Line1 = "#academic" Or Line1 = "#cocur" Then Exit Do
                            num = Left(Line1, InStr(Line1, "#") - 1)
                            element(CInt(num)) = True
                            score = Right(Line1, Len(Line1) - InStr(Line1, "#"))
                            scores(CInt(num)) = score
                            
                            If CInt(num) = 9 Then
                                    element9_count = element9_count + 1
                                    ReDim Preserve element9(1 To element9_count) As String
                                    element9(element9_count) = score
                           End If
                    
                    Loop
                    If Line1 = "#cocur" Then
                            For i = 1 To 5
                                    Input #1, cocur.kelab(i)
                                    Input #1, cocur.badan(i)
                                    Input #1, cocur.sukan(i)
                                    Input #1, cocur.kesel(i)
                            Next i
                            isCocurLoaded = True
                    End If
                   
                    While Not EOF(1)
                            Input #1, Line1
                            If Line1 = "#academic" And schooltype <> "SMK" Then
                                    isAcademicLoaded = True
                                    For i = 1 To 6
                                            Input #1, PKSR(i).a
                                            Input #1, PKSR(i).b
                                            Input #1, PKSR(i).C
                                            Input #1, PKSR(i).D
                                            Input #1, PKSR(i).E
                                            Input #1, PKSR(i).gpt
                                            Input #1, PKSR(i).total
                                    Next i
                                                     
                                    Input #1, UPSR.a
                                    Input #1, UPSR.b
                                    Input #1, UPSR.C
                                    Input #1, UPSR.D
                                    Input #1, UPSR.E
                                    Input #1, UPSR.gpt
                                    Input #1, UPSR.total
                           ElseIf Line1 = "#academic" And schooltype = "SMK" Then
                                    isAcademicLoaded = True
                                    For i = 1 To 3
                                            Input #1, PKSM1(i).a
                                            Input #1, PKSM1(i).b
                                            Input #1, PKSM1(i).C
                                            Input #1, PKSM1(i).D
                                            Input #1, PKSM1(i).E
                                            Input #1, PKSM1(i).gpt
                                            Input #1, PKSM1(i).total
                                    Next i
                                                     
                                    Input #1, PMR.a
                                    Input #1, PMR.b
                                    Input #1, PMR.C
                                    Input #1, PMR.D
                                    Input #1, PMR.E
                                    Input #1, PMR.gpt
                                    Input #1, PMR.total
                                    
                                    For i = 4 To 5
                                        Input #1, PKSM2(i).A1
                                        Input #1, PKSM2(i).A2
                                        Input #1, PKSM2(i).B3
                                        Input #1, PKSM2(i).B4
                                        Input #1, PKSM2(i).C5
                                        Input #1, PKSM2(i).C6
                                        Input #1, PKSM2(i).D7
                                        Input #1, PKSM2(i).E8
                                        Input #1, PKSM2(i).G9
                                        Input #1, PKSM2(i).gpt
                                        Input #1, PKSM2(i).total
                                    Next i
                                    
                                    Input #1, SPM.A1
                                    Input #1, SPM.A2
                                    Input #1, SPM.B3
                                    Input #1, SPM.B4
                                    Input #1, SPM.C5
                                    Input #1, SPM.C6
                                    Input #1, SPM.D7
                                    Input #1, SPM.E8
                                    Input #1, SPM.G9
                                    Input #1, SPM.gpt
                                    Input #1, SPM.total
                                    
                                    For i = 6 To 7
                                            Input #1, PKSM3(i).a
                                            Input #1, PKSM3(i).Am
                                            Input #1, PKSM3(i).Bp
                                            Input #1, PKSM3(i).b
                                            Input #1, PKSM3(i).Bm
                                            Input #1, PKSM3(i).Cp
                                            Input #1, PKSM3(i).C
                                            Input #1, PKSM3(i).Cm
                                            Input #1, PKSM3(i).Dp
                                            Input #1, PKSM3(i).D
                                            Input #1, PKSM3(i).F
                                            Input #1, PKSM3(i).gpt
                                            Input #1, PKSM3(i).total
                                    Next i
                                    
                                    Input #1, STPM.a
                                    Input #1, STPM.Am
                                    Input #1, STPM.Bp
                                    Input #1, STPM.b
                                    Input #1, STPM.Bm
                                    Input #1, STPM.Cp
                                    Input #1, STPM.C
                                    Input #1, STPM.Cm
                                    Input #1, STPM.Dp
                                    Input #1, STPM.D
                                    Input #1, STPM.F
                                    Input #1, STPM.gpt
                                    Input #1, STPM.total
                                    
                                    Input #1, STAM.a
                                    Input #1, STAM.Am
                                    Input #1, STAM.Bp
                                    Input #1, STAM.b
                                    Input #1, STAM.Bm
                                    Input #1, STAM.Cp
                                    Input #1, STAM.C
                                    Input #1, STAM.Cm
                                    Input #1, STAM.Dp
                                    Input #1, STAM.D
                                    Input #1, STAM.F
                                    Input #1, STAM.gpt
                                    Input #1, STAM.total
                                    
                                    
                            End If
                   Wend
                   
            Close #1
Else
            Open fileName For Append As #1
            Close #1
            'We'r done here
End If


WebBrowser1.Navigate App.Path & "\data\index.htm"

Exit Sub
hell:
MsgBox "Sorry, the data file " & fileName & " is damaged. You could try deleting it and running this program again", 16
End Sub
Attached Images
 
winterslam is offline   Reply With Quote
Old May 19th, 2007, 11:01 PM   #2
DigiRev
"Digital Revolution"
 
Join Date: Mar 05
Posts: 4,466
DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)
Re: Object variable or with block variable not set

What is WBCustomizer? Is the web browser's ActiveX control registering successfully in the install? Was the WBCustomizer code commented out when you compiled/installed it on the other computers?
DigiRev is offline   Reply With Quote
Old May 19th, 2007, 11:09 PM   #3
winterslam
Addicted Member
 
Join Date: Sep 02
Posts: 146
winterslam is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

It's commented out, bro..
winterslam is offline   Reply With Quote
Old May 19th, 2007, 11:17 PM   #4
DigiRev
"Digital Revolution"
 
Join Date: Mar 05
Posts: 4,466
DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)
Re: Object variable or with block variable not set

Quote:
Originally Posted by winterslam
It's commented out, bro..
Ok...

Are you using Option Explicit in your code?

What is cocur, PKSR, STMP, etc?
DigiRev is offline   Reply With Quote
Old May 19th, 2007, 11:21 PM   #5
winterslam
Addicted Member
 
Join Date: Sep 02
Posts: 146
winterslam is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

Yes I'm using option explicit..



Those are the UDTs stored in *.bas file


Code:
Public Type primary_type
        a As Integer
        b As Integer
        C As Integer
        D As Integer
        E As Integer
       
        gpt As Single
        total As Integer
End Type


Public Type secondary_type
        A1 As Integer
        A2 As Integer
        B3 As Integer
        B4 As Integer
        C5 As Integer
        C6 As Integer
        D7 As Integer
        E8 As Integer
        G9 As Integer
               
        gpt As Single
        total As Integer
End Type


Public Type preu_type
        a As Integer
        Am As Integer
        Bp As Integer
        b As Integer
        Bm As Integer
        Cp As Integer
        C As Integer
        Cm As Integer
        Dp As Integer
        D As Integer
        F As Integer
        
        total As Integer
        gpt As Single

End Type

Public Type cocur_type
        kelab(1 To 6) As Single
        badan(1 To 6) As Single
        sukan(1 To 6) As Single
        kesel(1 To 6) As Single
        
        peratus_kelab(1 To 5) As Single
        peratus_badan(1 To 5) As Single
        peratus_sukan(1 To 5) As Single
        peratus_kesel(1 To 5) As Single
        gps As Single
        
        count As Integer
End Type


Public PKSR(1 To 6) As primary_type
Public UPSR As primary_type

Public PKSM1(1 To 3) As primary_type
Public PMR As primary_type

Public PKSM2(4 To 5) As secondary_type
Public SPM As secondary_type

Public PKSM3(6 To 7) As preu_type
Public STPM As preu_type
Public STAM As preu_type
winterslam is offline   Reply With Quote
Old May 20th, 2007, 01:00 AM   #6
DigiRev
"Digital Revolution"
 
Join Date: Mar 05
Posts: 4,466
DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)DigiRev is a glorious beacon of light (400+)
Re: Object variable or with block variable not set

It'd help to know what line of code is raising the error.

The only code that I can think of that would cause it is the code that is commented out, but you said you still got the error with it commented.

Unless the error isn't happening in Form_Load().

The only other line that uses an object is the last one: WebBrowser1.Navigate which I highly doubt is causing an error. WebBrowser1 is the web browser control shown in the screen shot, right?

Sorry, only thing I can think of is the error is being caused by something outside of Form_Load().
DigiRev is offline   Reply With Quote
Old Feb 9th, 2008, 09:37 AM   #7
HiroRew
New Member
 
Join Date: Jan 08
Posts: 4
HiroRew is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

I have a code which is giving same error mesage when I try to work it. I tried it on 4 computers. Two of them have single core proccessors (a celeron and a pentium4 3.0 (with hyperthreading)); and code has worked properly on them. Other two have dual core processors (a D915 and a E4500), and code has not worked giving the error 91. (I have tried /numproc = 1 or other methods to use just one core, and no method has worked.) Already I wasn't able to find the solution.
HiroRew is offline   Reply With Quote
Old Feb 9th, 2008, 01:35 PM   #8
devonknows
Junior Member
 
Join Date: Feb 08
Posts: 20
devonknows is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

If you run via the designer UI and click Debug when the error occurs that should highlight a line, it sounds like you need to set something like

Set MyBrowser = New WebBrowser
or
set Col = New Collection

Just a little input from me
kind regards
Devon
devonknows is offline   Reply With Quote
Old Feb 9th, 2008, 01:43 PM   #9
zynder
Frenzied Member
 
zynder's Avatar
 
Join Date: Nov 06
Location: localhost
Posts: 1,398
zynder has a spectacular aura about (100+)zynder has a spectacular aura about (100+)
Re: Object variable or with block variable not set

Just shooting in the dark here... i know you are using webbrowser control. Can you check the version of Internet explorer to all workstations?

shdocvw.dll

I know that there are some issues to IE7 especially if your using IE6 or vice versa on the development.
zynder is offline   Reply With Quote
Old Feb 11th, 2008, 02:56 AM   #10
HiroRew
New Member
 
Join Date: Jan 08
Posts: 4
HiroRew is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

I've written before that I have a code wich is working properly on 2 of 4 computers. It is a DirectX application. I myself set two of the computers and the application working properly on one of them which has a single core processor. I think there is no software difference betwen them. All computers are windows XP installed .

The project includes just one form.
There is a referance to 'DirectX 8 for Visual basic Type Library'

It gives an error on at that line:
Code:
D3DDevice.SetTransform D3DTS_WORLD, matWorld
D3DDevice is declared at the declarations section of the form:
Code:
Dim D3DDevice As Direct3DDevice8
Ans is set in a sub procedure:
Code:
Set D3DDevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, DDDEVTYPE_HAL, frmMain.hWnd, BehaviourFlag, D3DWindow)
HiroRew is offline   Reply With Quote
Old Feb 11th, 2008, 04:00 AM   #11
Doogle
Frenzied Member
 
Join Date: Jul 06
Location: Maldon, Essex. UK
Posts: 1,617
Doogle has a spectacular aura about (150+)Doogle has a spectacular aura about (150+)
Re: Object variable or with block variable not set

Winterslam: I'd have thought that removing this line:
Code:
On Error GoTo hell
and running the code would highlight the failing statement.

HiroReW: I suggest you start your own thread, you're just confusing things (well me, at least) in this one.
Doogle is offline   Reply With Quote
Old Feb 13th, 2008, 03:01 PM   #12
HiroRew
New Member
 
Join Date: Jan 08
Posts: 4
HiroRew is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

Doogle:
I thought that samething parallel between two cases that codes are working on some computers and not working on the others. And the problem may have its source in hardware, but not in software. If someone has any idea about this situation... But you may be right. It may be better if I start a new thread. Thanks.
HiroRew is offline   Reply With Quote
Old Feb 13th, 2008, 03:02 PM   #13
HiroRew
New Member
 
Join Date: Jan 08
Posts: 4
HiroRew is an unknown quantity at this point (<10)
Re: Object variable or with block variable not set

qwert
HiroRew is offline   Reply With Quote
Old Feb 13th, 2008, 04:00 PM   #14
randem
Banned
 
randem's Avatar
 
Join Date: Oct 02
Location: Maui, Hawaii
Posts: 11,386
randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)randem is a glorious beacon of light (400+)
Re: Object variable or with block variable not set

It's your deployment. I would bet that the computers that your code worked on and did not work on had different version of IE installed. IE6 vs IE7... It's a deployment issue...
randem is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:20 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.