Very Basic Winsock Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Very Basic Winsock Problem

  1. #1
    Kevin Guest

    Very Basic Winsock Problem


    I'm just getting started with VB6, and I just want to right a simple program
    that returns my IP address. I keep getting an error "Object Required".

    What am I missing in my code that sets up the winsock controls?


    Program - Click one button, it displays the IP address. Click the other button
    to exit the program.

    Private Sub Command1_Click()
    RetVar = Winsock1.LocalIP
    Label1.Caption = RetVar
    End Sub

    Private Sub Command2_Click()
    End
    End Sub

    Any help for a beginner would be helpful.


  2. #2
    bob butler Guest

    Re: Very Basic Winsock Problem


    Kevin <khartlen@hrsb.ns.ca> wrote in message
    news:394d7875$1@news.devx.com...
    >
    > I'm just getting started with VB6, and I just want to right a simple

    program
    > that returns my IP address. I keep getting an error "Object Required".
    >
    > What am I missing in my code that sets up the winsock controls?


    Not in code - on the form. Click Project / Components and select the
    Microsoft Winsock Control. That will add it to your toolbar. Then select
    it and draw it on your form.

    > Program - Click one button, it displays the IP address. Click the other

    button
    > to exit the program.
    >
    > Private Sub Command1_Click()
    > RetVar = Winsock1.LocalIP
    > Label1.Caption = RetVar
    > End Sub
    >
    > Private Sub Command2_Click()
    > End


    Don't se End - it's a bad habit to get in to. VB applications terminate
    when you unload all forms and free all allocated resources. END is a hard
    abort and when you start getting into more complicated apps it can cause
    problems.
    Change the line above to: Unload Me

    > End Sub
    >
    > Any help for a beginner would be helpful.
    >






  3. #3
    Kevin Guest

    Re: Very Basic Winsock Problem


    "bob butler" <butlerbob@my-Deja.com> wrote:

    Unload Me works well, but what am I missing with the Winsock Call. What do
    I need to do, for my app to see or make calls to the Winsock controls?

  4. #4
    bob butler Guest

    Re: Very Basic Winsock Problem

    Kevin <khartlen@hrsb.ns.ca> wrote in message
    news:394ebbb3$1@news.devx.com...
    >
    > "bob butler" <butlerbob@my-Deja.com> wrote:
    >
    > Unload Me works well, but what am I missing with the Winsock Call. What do
    > I need to do, for my app to see or make calls to the Winsock controls?


    Did you see the comment I embedded in the previous post right after the
    Command1_Click code?




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center