Link to home
Start Free TrialLog in
Avatar of KingSencat
KingSencat

asked on

Object Reuired .. HELP PLS newbie here

Hello .. i am a newbie at VB6.0

i run my application and i click the button and receive this error

--------------------
Run-time error 424:

Object Required
----------------------

Help plss!!
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

can you post the code on the click button?

this is simply an object variable that got not initalizd
Avatar of KingSencat
KingSencat

ASKER

yes
Hello KingSencat,

better post a bit of your code, this error happens when you try to work with an object that is not initialized

bruintje
Private Sub Command1_Click()
    'This is your button code that connects to the webpage
    Winsock1.Close
    Winsock1.Connect "http://www.yourwebpage.com", 80
End Sub

Private Sub Winsock1_Connect()
    'The control is now connected, request the webpage
    Winsock1.SendData "GET /yourpage.php HTTP/1.1" & vbCrLf & vbCrLf
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    'This sub will be called when the server is sending data
    'Declare Vars
    Dim strData As String
    '
    'Retrieve the data
    Winsock1.GetData strData
    '
    'And just for you: output the data, this will show you the HTML code of the page
    'You can remove this
    Debug.Print strData
End Sub
does the winsock control that you have on the form really the name Winsock1 ?

let me assume that you do NOT have the following in front of all your modules:

OPTION EXPLICIT

you should also enable the "Require Variable Declaration" option in the options of VB
Can you give me the working source please ? .. i am newbie at VB6.0
There is a question I asked you: Is there a control with the name "Winsock1" on your form?

Note: as you are a newbie, you should follow the advice I gave you about the option explicit.

if you answer with YES the question, have set the option explicit, can you try to compile the project.
I am SURE the project does NOT compile.
This what i paste before its all the source ...  the Winsock1 name is only in the source  ... i enable  "Require Variable Declaration" .. and stil lsame problem
>>the Winsock1 name is only in the source
you need to add a winsock control to the form

which is doen in this sample
source: http://www.vbip.com/winsock/winsock_whois.asp
can you copy and paste here what i must to put at my source?
no because if you did not put a control on your form you really have to do it yourself

1. In your vb IDE rightclick on the component tab
2. then click on components
3. look for the microsoft winsock control
4. check the box in front of it and it will be added to the component tab
5. now drag it to your form
6. that will enable you to work with winsock1 in your code
I dont understand what you mean -->" IDE" ... my english not so good ..
Component MSWINSCK.OCX not correctly registered
ok can describe what you did?

. IDE is the VB environment where you place your form etc....

>> Component MSWINSCK.OCX not correctly registered

when does that happen?
ok i dont see any errors now ... but its not connecting to the site
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have forgotten to add the Microsoft Winsock Control.

To do so:

Right click on the left side of your dev environment, click on "Components...", then checkmark "Microsoft Winsock Control".

If you are actually COPYING your compiled .exe to another computer, you ALSO need to copy the winsock control (*.ocx) to that system. When you click on components, you will see what it is called and where. (I.e., MSWINSCK.OCX).
though i believe my last comment answered the question, it probably was also answered here which i didn't see at the time

https://www.experts-exchange.com/questions/21796453/Connecting-to-a-website-without-any-browser.html