If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > visual basic pro 6. variable question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-10, 15:17
kato01 kato01 is offline
Registered User
 
Join Date: Nov 2004
Posts: 17
visual basic pro 6. variable question

Hello,


I am using Visual Basic pro ver 6.0. Please see attached the project file
I defined in module1 a type variables as:

Type blox
name As String
ind As Integer
Lx As Double
Ly As Double
Lz As Double
x0 As Double
y0 As Double
z0 As Double
material As String
assigninside As Boolean
xcolor As String
transparency As Double
End Type

In the same module, I define:

Global blocks() As blox

Then, in the main Form1 I have

n=10

Redim blocks(n)

and then

for i=1 to n

call fun(blocks(i))

next i
When it gets to the line
"Call Create_Box_and_Assign_Material(pfln, blocks(indi))"
I get the following error message

"only user-defined types in public object modules can be coerced to or from a variant or passed to late bound functions"

any ideas on how to fix this?

Thank you
Reply With Quote
  #2 (permalink)  
Old 03-30-10, 19:18
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
Try this:
Code:
Public Type Blox
  name As String
  ind As Integer
  Lx As Double
  '...
End Type

Public blocks() As blox
The Global keyword was deprecated with, I believe, VB5, and is only included for backwards compatibility in later versions. Public should be used with VB6.
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On