Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having trouble with faq222-607 (ping in vbasic)

Status
Not open for further replies.

sanderk

Technical User
Jul 12, 2001
9
NL
Hi

Can someone gave me some tips about faq222-607 (ping in vbasic). I'm having serious trouble using it. I already asked a question about this. (thread222-105415 really would appreciate some help on this matter.
Thanks in advance
Sander
 
hi,

i haven't read the faq and this is what i call cheating ...

Try changing the scope of the Type to private and put it in the original form module. in you need to use the type elsewhere copy it.
 
Hi,
Maybe I was not clear enough.
I tried to move types but I keep on getting errors. I don't know very much about user defined types (it's a whole new part of VB to me, module classes aren't my thing to yet). Normally if I try to do something and I don't know were to start, a piece of sample code mostly gives me an indication where to begin. On this one, I have not a single clou how to proceed so a working example would be nice.

Thx
Sander
 
ok, this is a public Type example

public type MyRecord
myname as string
myage as integer
myIsMale as boolean
end type

public means you can use a definition in other modules.
Although, for some reason, you are not allowed to have Public Types in Form Modules or Class Modules. So what i do is make the Type private. This means it can only be accessed in the module it was created in.

Heres an example of a Private Type:

private type MyRecord
myname as string
myage as integer
myIsMale as boolean
end type

Also, with types you can do this:

Private Sub MySub (TheRecord As MyRecord)
'( because the type is private)

but you cannot do this:
Public Sub MySub (TheRecord As MyRecord)
' ( because the type is public)

 
The code should work fine (I wrote the FAQ) . . . what kind of error are you getting? - Jeff Marler B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top