Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

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!!
0
KingSencat
Asked:
KingSencat
  • 8
  • 6
  • 3
  • +1
1 Solution
 
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
0
 
KingSencatAuthor Commented:
yes
0
 
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now