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!!
KingSencatAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
can you post the code on the click button?

this is simply an object variable that got not initalizd
KingSencatAuthor Commented:
yes
bruintjeCommented:
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

KingSencatAuthor Commented:
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
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
KingSencatAuthor Commented:
Can you give me the working source please ? .. i am newbie at VB6.0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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.
KingSencatAuthor Commented:
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
bruintjeCommented:
>>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
KingSencatAuthor Commented:
can you copy and paste here what i must to put at my source?
bruintjeCommented:
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
KingSencatAuthor Commented:
I dont understand what you mean -->" IDE" ... my english not so good ..
KingSencatAuthor Commented:
Component MSWINSCK.OCX not correctly registered
bruintjeCommented:
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?
KingSencatAuthor Commented:
ok i dont see any errors now ... but its not connecting to the site
bruintjeCommented:
this worked for me

Option Explicit

Private Sub Command1_Click()
    'This is your button code that connects to the webpage
    Winsock1.Close
    Winsock1.RemoteHost = "experts-exchange.com"
    Winsock1.RemotePort = 80
    Winsock1.Connect
End Sub

Private Sub Winsock1_Connect()
    'The control is now connected, request the webpage
    Winsock1.SendData "GET /Programming/Programming_Platforms/Win_Prog/Q_21795925.html 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
    '
    Winsock1.GetData strData, vbString
    Winsock1.Close

    '
    '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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cool12399Commented:
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).
bruintjeCommented:
though i believe my last comment answered the question, it probably was also answered here which i didn't see at the time

http://www.experts-exchange.com/Q_21796453.html
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.