Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with Variant data type

dartmedartme Member Posts: 41
[b][red]This message was edited by dartme at 2003-11-9 1:7:51[/red][/b][hr]
Dear Sir or madam

I am having a problem. I have created a type: wff
goes something like this.
[code]
Private Type wff
Level As Integer
FirstExp As Variant
SecondExp As Variant
FirstExpNeg As Boolean
SecondExpNeg As Boolean
Current As Boolean
Connective As String
Negated As Boolean
End Type
[/code]
the type declaration works fine, and I can use all the things within the type. However, when I create a wff that looks something like this
[code]
dim wff1() as wff
redim wff1(1)
redim wff1(2)
with wff1(1)
.firstexp = "A"
.connective = "I"
end with
[/code]
that's good, that's all it takes, anyway. Surely you will notice that it is a dynamic array with currently two elements, the first one having two set properties (non-zero and non-nothing properties that is). All this is fine, the program works with all this information until I try to do this.
I have attempted (it is necessary to do this for this particular program) to set the following[code]
wff1(1).secondexp = wff1(2)[/code]
And as you can see, I am trying to put all of wff1(2) (with its 8 members) into wff1(1) 's secondexp member. I thought that this would be possible because secondexp is a variant type.
Please respond with any helpful comments you might have, or, even if you don't think they're going to be helpful, respond anyway. Thank you very much

Aaron Laws


Comments

  • Ray2003Ray2003 Member Posts: 163
    : [b][red]This message was edited by dartme at 2003-11-9 1:7:51[/red][/b][hr]
    : Dear Sir or madam
    :
    : I am having a problem. I have created a type: wff
    : goes something like this.
    : [code]
    : Private Type wff
    : Level As Integer
    : FirstExp As Variant
    : SecondExp As Variant
    : FirstExpNeg As Boolean
    : SecondExpNeg As Boolean
    : Current As Boolean
    : Connective As String
    : Negated As Boolean
    : End Type
    : [/code]
    : the type declaration works fine, and I can use all the things within the type. However, when I create a wff that looks something like this
    : [code]
    : dim wff1() as wff
    : redim wff1(1)
    : redim wff1(2)
    : with wff1(1)
    : .firstexp = "A"
    : .connective = "I"
    : end with
    : [/code]
    : that's good, that's all it takes, anyway. Surely you will notice that it is a dynamic array with currently two elements, the first one having two set properties (non-zero and non-nothing properties that is). All this is fine, the program works with all this information until I try to do this.
    : I have attempted (it is necessary to do this for this particular program) to set the following[code]
    : wff1(1).secondexp = wff1(2)[/code]
    : And as you can see, I am trying to put all of wff1(2) (with its 8 members) into wff1(1) 's secondexp member. I thought that this would be possible because secondexp is a variant type.
    : Please respond with any helpful comments you might have, or, even if you don't think they're going to be helpful, respond anyway. Thank you very much
    :
    : Aaron Laws
    :
    :
    :
    Hi,
    Declare the SecondExp as an OBJECT. This will help you!
    Something like this:
    [code]
    Private Type wff
    ...
    SecondExp As New wff
    ...
    End Type
    [/code]
    If VB won't let you compile it, use this:
    [code]
    Private Type wff_exp
    Level As Integer
    FirstExpNeg As Boolean
    SecondExpNeg As Boolean
    Current As Boolean
    Connective As String
    Negated As Boolean
    End Type
    Private Type wff
    Level As Integer
    [red] FirstExp As New wff_exp
    SecondExp As New wff_exp[/red]
    FirstExpNeg As Boolean
    SecondExpNeg As Boolean
    Current As Boolean
    Connective As String
    Negated As Boolean
    End Type
    [/code]
    I really hope this will help you because this is kind of a strange
    problem.
    Greets and good luck!
    Ray2003
  • dartmedartme Member Posts: 41
    : : [b][red]This message was edited by dartme at 2003-11-9 1:7:51[/red][/b][hr]
    : : Dear Sir or madam
    : :
    : : I am having a problem. I have created a type: wff
    : : goes something like this.
    : : [code]
    : : Private Type wff
    : : Level As Integer
    : : FirstExp As Variant
    : : SecondExp As Variant
    : : FirstExpNeg As Boolean
    : : SecondExpNeg As Boolean
    : : Current As Boolean
    : : Connective As String
    : : Negated As Boolean
    : : End Type
    : : [/code]
    : : the type declaration works fine, and I can use all the things within the type. However, when I create a wff that looks something like this
    : : [code]
    : : dim wff1() as wff
    : : redim wff1(1)
    : : redim wff1(2)
    : : with wff1(1)
    : : .firstexp = "A"
    : : .connective = "I"
    : : end with
    : : [/code]
    : : that's good, that's all it takes, anyway. Surely you will notice that it is a dynamic array with currently two elements, the first one having two set properties (non-zero and non-nothing properties that is). All this is fine, the program works with all this information until I try to do this.
    : : I have attempted (it is necessary to do this for this particular program) to set the following[code]
    : : wff1(1).secondexp = wff1(2)[/code]
    : : And as you can see, I am trying to put all of wff1(2) (with its 8 members) into wff1(1) 's secondexp member. I thought that this would be possible because secondexp is a variant type.
    : : Please respond with any helpful comments you might have, or, even if you don't think they're going to be helpful, respond anyway. Thank you very much
    : :
    : : Aaron Laws
    : :
    : :
    : :
    : Hi,
    : Declare the SecondExp as an OBJECT. This will help you!
    : Something like this:
    : [code]
    : Private Type wff
    : ...
    : SecondExp As New wff
    : ...
    : End Type
    : [/code]
    : If VB won't let you compile it, use this:
    : [code]
    : Private Type wff_exp
    : Level As Integer
    : FirstExpNeg As Boolean
    : SecondExpNeg As Boolean
    : Current As Boolean
    : Connective As String
    : Negated As Boolean
    : End Type
    : Private Type wff
    : Level As Integer
    : [red] FirstExp As New wff_exp
    : SecondExp As New wff_exp[/red]
    : FirstExpNeg As Boolean
    : SecondExpNeg As Boolean
    : Current As Boolean
    : Connective As String
    : Negated As Boolean
    : End Type
    : [/code]
    : I really hope this will help you because this is kind of a strange
    : problem.
    : Greets and good luck!
    : Ray2003
    :


    Dear Sir

    That is a very good solution, however, I need to decide whether SecondExp is a WFF or a Capital at design time (also need to do that with FirstExp). If you don't know what I'm talking about, that's fine, you don't have to. I need to be able to store an instance of a WFF in the firstexp of wff1(x, 1), and (x, 2), etc. Also in Second exp. That's fine, however, I need also to be able to put just a Capital "A", or "B" or something in there too. Thanks for your help, just please give more :D.

    With Much Thanks and Sine Cera
    Aaron Laws

    ==================================
    I-Forever Programming
    Horn Performance Major
    University of Oklahoma
    ==================================

  • Ray2003Ray2003 Member Posts: 163
    : : : [b][red]This message was edited by dartme at 2003-11-9 1:7:51[/red][/b][hr]
    : : : Dear Sir or madam
    : : :
    : : : I am having a problem. I have created a type: wff
    : : : goes something like this.
    : : : [code]
    : : : Private Type wff
    : : : Level As Integer
    : : : FirstExp As Variant
    : : : SecondExp As Variant
    : : : FirstExpNeg As Boolean
    : : : SecondExpNeg As Boolean
    : : : Current As Boolean
    : : : Connective As String
    : : : Negated As Boolean
    : : : End Type
    : : : [/code]
    : : : the type declaration works fine, and I can use all the things within the type. However, when I create a wff that looks something like this
    : : : [code]
    : : : dim wff1() as wff
    : : : redim wff1(1)
    : : : redim wff1(2)
    : : : with wff1(1)
    : : : .firstexp = "A"
    : : : .connective = "I"
    : : : end with
    : : : [/code]
    : : : that's good, that's all it takes, anyway. Surely you will notice that it is a dynamic array with currently two elements, the first one having two set properties (non-zero and non-nothing properties that is). All this is fine, the program works with all this information until I try to do this.
    : : : I have attempted (it is necessary to do this for this particular program) to set the following[code]
    : : : wff1(1).secondexp = wff1(2)[/code]
    : : : And as you can see, I am trying to put all of wff1(2) (with its 8 members) into wff1(1) 's secondexp member. I thought that this would be possible because secondexp is a variant type.
    : : : Please respond with any helpful comments you might have, or, even if you don't think they're going to be helpful, respond anyway. Thank you very much
    : : :
    : : : Aaron Laws
    : : :
    : : :
    : : :
    : : Hi,
    : : Declare the SecondExp as an OBJECT. This will help you!
    : : Something like this:
    : : [code]
    : : Private Type wff
    : : ...
    : : SecondExp As New wff
    : : ...
    : : End Type
    : : [/code]
    : : If VB won't let you compile it, use this:
    : : [code]
    : : Private Type wff_exp
    : : Level As Integer
    : : FirstExpNeg As Boolean
    : : SecondExpNeg As Boolean
    : : Current As Boolean
    : : Connective As String
    : : Negated As Boolean
    : : End Type
    : : Private Type wff
    : : Level As Integer
    : : [red] FirstExp As New wff_exp
    : : SecondExp As New wff_exp[/red]
    : : FirstExpNeg As Boolean
    : : SecondExpNeg As Boolean
    : : Current As Boolean
    : : Connective As String
    : : Negated As Boolean
    : : End Type
    : : [/code]
    : : I really hope this will help you because this is kind of a strange
    : : problem.
    : : Greets and good luck!
    : : Ray2003
    : :
    :
    :
    : Dear Sir
    :
    : That is a very good solution, however, I need to decide whether SecondExp is a WFF or a Capital at design time (also need to do that with FirstExp). If you don't know what I'm talking about, that's fine, you don't have to. I need to be able to store an instance of a WFF in the firstexp of wff1(x, 1), and (x, 2), etc. Also in Second exp. That's fine, however, I need also to be able to put just a Capital "A", or "B" or something in there too. Thanks for your help, just please give more :D.
    :
    : With Much Thanks and Sine Cera
    : Aaron Laws
    :
    : ==================================
    : I-Forever Programming
    : Horn Performance Major
    : University of Oklahoma
    : ==================================
    :
    :
    Hmmm, my english is not very well so don't understand some sentences.
    Could you please give some details?
    Thanks and I'm able to help everyone, (but I'm still busy with Randows... for the ones who know what I'm talking about :-D)
    Ray2003
  • Ray2003Ray2003 Member Posts: 163
    : : : : [b][red]This message was edited by dartme at 2003-11-9 1:7:51[/red][/b][hr]
    : : : : Dear Sir or madam
    : : : :
    : : : : I am having a problem. I have created a type: wff
    : : : : goes something like this.
    : : : : [code]
    : : : : Private Type wff
    : : : : Level As Integer
    : : : : FirstExp As Variant
    : : : : SecondExp As Variant
    : : : : FirstExpNeg As Boolean
    : : : : SecondExpNeg As Boolean
    : : : : Current As Boolean
    : : : : Connective As String
    : : : : Negated As Boolean
    : : : : End Type
    : : : : [/code]
    : : : : the type declaration works fine, and I can use all the things within the type. However, when I create a wff that looks something like this
    : : : : [code]
    : : : : dim wff1() as wff
    : : : : redim wff1(1)
    : : : : redim wff1(2)
    : : : : with wff1(1)
    : : : : .firstexp = "A"
    : : : : .connective = "I"
    : : : : end with
    : : : : [/code]
    : : : : that's good, that's all it takes, anyway. Surely you will notice that it is a dynamic array with currently two elements, the first one having two set properties (non-zero and non-nothing properties that is). All this is fine, the program works with all this information until I try to do this.
    : : : : I have attempted (it is necessary to do this for this particular program) to set the following[code]
    : : : : wff1(1).secondexp = wff1(2)[/code]
    : : : : And as you can see, I am trying to put all of wff1(2) (with its 8 members) into wff1(1) 's secondexp member. I thought that this would be possible because secondexp is a variant type.
    : : : : Please respond with any helpful comments you might have, or, even if you don't think they're going to be helpful, respond anyway. Thank you very much
    : : : :
    : : : : Aaron Laws
    : : : :
    : : : :
    : : : :
    : : : Hi,
    : : : Declare the SecondExp as an OBJECT. This will help you!
    : : : Something like this:
    : : : [code]
    : : : Private Type wff
    : : : ...
    : : : SecondExp As New wff
    : : : ...
    : : : End Type
    : : : [/code]
    : : : If VB won't let you compile it, use this:
    : : : [code]
    : : : Private Type wff_exp
    : : : Level As Integer
    : : : FirstExpNeg As Boolean
    : : : SecondExpNeg As Boolean
    : : : Current As Boolean
    : : : Connective As String
    : : : Negated As Boolean
    : : : End Type
    : : : Private Type wff
    : : : Level As Integer
    : : : [red] FirstExp As New wff_exp
    : : : SecondExp As New wff_exp[/red]
    : : : FirstExpNeg As Boolean
    : : : SecondExpNeg As Boolean
    : : : Current As Boolean
    : : : Connective As String
    : : : Negated As Boolean
    : : : End Type
    : : : [/code]
    : : : I really hope this will help you because this is kind of a strange
    : : : problem.
    : : : Greets and good luck!
    : : : Ray2003
    : : :
    : :
    : :
    : : Dear Sir
    : :
    : : That is a very good solution, however, I need to decide whether SecondExp is a WFF or a Capital at design time (also need to do that with FirstExp). If you don't know what I'm talking about, that's fine, you don't have to. I need to be able to store an instance of a WFF in the firstexp of wff1(x, 1), and (x, 2), etc. Also in Second exp. That's fine, however, I need also to be able to put just a Capital "A", or "B" or something in there too. Thanks for your help, just please give more :D.
    : :
    : : With Much Thanks and Sine Cera
    : : Aaron Laws
    : :
    : : ==================================
    : : I-Forever Programming
    : : Horn Performance Major
    : : University of Oklahoma
    : : ==================================
    : :
    : :
    : Hmmm, my english is not very well so don't understand some sentences.
    : Could you please give some details?
    : Thanks and I'm able to help everyone, (but I'm still busy with Randows... for the ones who know what I'm talking about :-D)
    : Ray2003
    :
    PS: I don't understand why you do this:
    [code]dim wff1() as wff
    [red]redim wff1(1)
    redim wff1(2)[/red]
    with wff1(1)
    .firstexp = "A"
    .connective = "I"
    end with[/code]
    Why do you redim twice? and why if you already know the length? (the
    second answer could be: because it's an example, but why the first?)

  • dartmedartme Member Posts: 41

    : : Hmmm, my english is not very well so don't understand some sentences.
    : : Could you please give some details?
    : : Thanks and I'm able to help everyone, (but I'm still busy with Randows... for the ones who know what I'm talking about :-D)
    : : Ray2003
    : :
    : PS: I don't understand why you do this:
    : [code]dim wff1() as wff
    : [red]redim wff1(1)
    : redim wff1(2)[/red]
    : with wff1(1)
    : .firstexp = "A"
    : .connective = "I"
    : end with[/code]
    : Why do you redim twice? and why if you already know the length? (the
    : second answer could be: because it's an example, but why the first?)
    :
    :

    Dear Sir

    I do not recall the reason, however, I think it is because those are found twice throughout the code, and I just copied and pasted the relevant code, and that was part of it. It could be just as well
    [code]
    ReDim wff1(1 to 2)
    [/code]

    I think...Good question.

    Sincerely
    Aaron Laws

    ==================================
    I-Forever Programming
    Horn Performance Major
    University of Oklahoma
    ==================================

Sign In or Register to comment.