dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: How to set values for textboxes that is not visible

  1. #1
    Join Date
    Feb 2010
    Posts
    16

    Talking How to set values for textboxes that is not visible

    hello,i think this is just a simple question but im not really familiar with the basics of VB6.0 so i am asking it, can i ask how can i set integer value on text1.text without making the value visible on the textbox when i run the program? thanks

    like text1.text = 1?

    but when the program is ran it can't be seen that a number is on the textbox?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to set values for textboxes that is not visible

    You can't do that, but you can make the textbox visible or not. Otherwise, use two textboxes and hide the one that you want hidden

    You can MOVE the Top and Left corner, to line them up
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2008
    Location
    Bangalore
    Posts
    149

    Re: How to set values for textboxes that is not visible

    Using a variable is better option instead of textbox. Why do you want something like that?

    in any case if you dont want to display the value in textbox ,eventhough textbox is visible then

    try
    Code:
    Textbox1.PasswordChar=" "
    Encourage the efforts of fellow members by rating

    Lets not Spoon Feed and create pool of lazy programmers

    - ComIT Solutions

  4. #4
    Join Date
    Feb 2010
    Posts
    16

    Re: How to set values for textboxes that is not visible

    uhm okay, here's the situation, i am making a program with 5 frames with 4x4 textboxes each, and 1 frame which is reserved for the output.. the user is required to input the angle to be converted and placed on textboxes on each frame. Or he can also just manually place numbers on the textboxes..

    Code:
    Const pi = 3.14159265
    Dim Answer As Double
    
    Private Sub Command1_Click()
    If Option1.Value = True Then
    converter = pi / 180
    axx.Text = Sin(angle.Text * converter)
    ayx.Text = Round(Cos(angle.Text * converter), 2)
    azx.Text = Round(Cos(angle.Text * converter), 2)
    ac1.Text = 0
    axy.Text = Round(Cos(angle.Text * converter), 2)
    ayy.Text = Round(Cos(angle.Text * converter), 2)
    azy.Text = Sin(angle.Text * converter)
    ac2.Text = 0
    axz.Text = Round(Cos(angle.Text * converter), 2)
    ayz.Text = -Sin(angle.Text * converter)
    azz.Text = Round(Cos(angle.Text * converter), 2)
    ac3.Text = 0
    atransx.Text = 0
    atransy.Text = 0
    atransz.Text = 0
    ac4.Text = 1
    ElseIf Option2.Value = True Then
    converter = pi / 180
    bxx.Text = Sin(angle.Text * converter)
    byx.Text = Round(Cos(angle.Text * converter), 2)
    bzx.Text = Round(Cos(angle.Text * converter), 2)
    bc1.Text = 0
    bxy.Text = Round(Cos(angle.Text * converter), 2)
    byy.Text = Round(Cos(angle.Text * converter), 2)
    bzy.Text = Sin(angle.Text * converter)
    bc2.Text = 0
    bxz.Text = Round(Cos(angle.Text * converter), 2)
    byz.Text = -Sin(angle.Text * converter)
    bzz.Text = Round(Cos(angle.Text * converter), 2)
    bc3.Text = 0
    btransx.Text = 0
    btransy.Text = 0
    btransz.Text = 0
    bc4.Text = 1
    ElseIf Option3.Value = True Then
    converter = pi / 180
    cxx.Text = Sin(angle.Text * converter)
    cyx.Text = Round(Cos(angle.Text * converter), 2)
    czx.Text = Round(Cos(angle.Text * converter), 2)
    cc1.Text = 0
    cxy.Text = Round(Cos(angle.Text * converter), 2)
    cyy.Text = Round(Cos(angle.Text * converter), 2)
    czy.Text = Sin(angle.Text * converter)
    cc2.Text = 0
    cxz.Text = Round(Cos(angle.Text * converter), 2)
    cyz.Text = -Sin(angle.Text * converter)
    czz.Text = Round(Cos(angle.Text * converter), 2)
    cc3.Text = 0
    ctransx.Text = 0
    ctransy.Text = 0
    ctransz.Text = 0
    cc4.Text = 1
    ElseIf Option4.Value = True Then
    converter = pi / 180
    dxx.Text = Sin(angle.Text * converter)
    dyx.Text = Round(Cos(angle.Text * converter), 2)
    dzx.Text = Round(Cos(angle.Text * converter), 2)
    dc1.Text = 0
    dxy.Text = Round(Cos(angle.Text * converter), 2)
    dyy.Text = Round(Cos(angle.Text * converter), 2)
    dzy.Text = Sin(angle.Text * converter)
    dc2.Text = 0
    dxz.Text = Round(Cos(angle.Text * converter), 2)
    dyz.Text = -Sin(angle.Text * converter)
    dzz.Text = Round(Cos(angle.Text * converter), 2)
    dc3.Text = 0
    dtransx.Text = 0
    dtransy.Text = 0
    dtransz.Text = 0
    dc4.Text = 1
    ElseIf Option5.Value = True Then
    converter = pi / 180
    exx.Text = Sin(angle.Text * converter)
    eyx.Text = Round(Cos(angle.Text * converter), 2)
    ezx.Text = Round(Cos(angle.Text * converter), 2)
    ec1.Text = 0
    exy.Text = Round(Cos(angle.Text * converter), 2)
    eyy.Text = Round(Cos(angle.Text * converter), 2)
    ezy.Text = Sin(angle.Text * converter)
    ec2.Text = 0
    exz.Text = Round(Cos(angle.Text * converter), 2)
    eyz.Text = -Sin(angle.Text * converter)
    ezz.Text = Round(Cos(angle.Text * converter), 2)
    ec3.Text = 0
    etransx.Text = 0
    etransy.Text = 0
    etransz.Text = 0
    ec4.Text = 1
    Else
    MsgBox ("Please choose your Transformation")
    End If
    End Sub
    
    Private Sub Command2_Click()
    If Option1.Value = True Then
    converter = pi / 180
    axx.Text = Round(Cos(angle.Text * converter), 2)
    ayx.Text = Round(Cos(angle.Text * converter), 2)
    azx.Text = -Sin(angle.Text * converter)
    ac1.Text = 0
    axy.Text = Round(Cos(angle.Text * converter), 2)
    ayy.Text = Sin(angle.Text * converter)
    azy.Text = Round(Cos(angle.Text * converter), 2)
    ac2.Text = 0
    axz.Text = Sin(angle.Text * converter)
    ayz.Text = Round(Cos(angle.Text * converter), 2)
    azz.Text = Round(Cos(angle.Text * converter), 2)
    ac3.Text = 0
    atransx.Text = 0
    atransy.Text = 0
    atransz.Text = 0
    ac4.Text = 1
    ElseIf Option2.Value = True Then
    converter = pi / 180
    bxx.Text = Round(Cos(angle.Text * converter), 2)
    byx.Text = Round(Cos(angle.Text * converter), 2)
    bzx.Text = -Sin(angle.Text * converter)
    bc1.Text = 0
    bxy.Text = Round(Cos(angle.Text * converter), 2)
    byy.Text = Sin(angle.Text * converter)
    bzy.Text = Round(Cos(angle.Text * converter), 2)
    bc2.Text = 0
    bxz.Text = Sin(angle.Text * converter)
    byz.Text = Round(Cos(angle.Text * converter), 2)
    bzz.Text = Round(Cos(angle.Text * converter), 2)
    bc3.Text = 0
    btransx.Text = 0
    btransy.Text = 0
    btransz.Text = 0
    bc4.Text = 1
    ElseIf Option3.Value = True Then
    converter = pi / 180
    cxx.Text = Round(Cos(angle.Text * converter), 2)
    cyx.Text = Round(Cos(angle.Text * converter), 2)
    czx.Text = -Sin(angle.Text * converter)
    cc1.Text = 0
    cxy.Text = Round(Cos(angle.Text * converter), 2)
    cyy.Text = Sin(angle.Text * converter)
    czy.Text = Round(Cos(angle.Text * converter), 2)
    cc2.Text = 0
    cxz.Text = Sin(angle.Text * converter)
    cyz.Text = Round(Cos(angle.Text * converter), 2)
    czz.Text = Round(Cos(angle.Text * converter), 2)
    cc3.Text = 0
    ctransx.Text = 0
    ctransy.Text = 0
    ctransz.Text = 0
    cc4.Text = 1
    ElseIf Option4.Value = True Then
    converter = pi / 180
    dxx.Text = Round(Cos(angle.Text * converter), 2)
    dyx.Text = Round(Cos(angle.Text * converter), 2)
    dzx.Text = -Sin(angle.Text * converter)
    dc1.Text = 0
    dxy.Text = Round(Cos(angle.Text * converter), 2)
    dyy.Text = Sin(angle.Text * converter)
    dzy.Text = Round(Cos(angle.Text * converter), 2)
    dc2.Text = 0
    dxz.Text = Sin(angle.Text * converter)
    dyz.Text = Round(Cos(angle.Text * converter), 2)
    dzz.Text = Round(Cos(angle.Text * converter), 2)
    dc3.Text = 0
    dtransx.Text = 0
    dtransy.Text = 0
    dtransz.Text = 0
    dc4.Text = 1
    ElseIf Option5.Value = True Then
    converter = pi / 180
    exx.Text = Round(Cos(angle.Text * converter), 2)
    eyx.Text = Round(Cos(angle.Text * converter), 2)
    ezx.Text = -Sin(angle.Text * converter)
    ec1.Text = 0
    exy.Text = Round(Cos(angle.Text * converter), 2)
    eyy.Text = Sin(angle.Text * converter)
    ezy.Text = Round(Cos(angle.Text * converter), 2)
    ec2.Text = 0
    exz.Text = Sin(angle.Text * converter)
    eyz.Text = Round(Cos(angle.Text * converter), 2)
    ezz.Text = Round(Cos(angle.Text * converter), 2)
    ec3.Text = 0
    etransx.Text = 0
    etransy.Text = 0
    etransz.Text = 0
    ec4.Text = 1
    Else
    MsgBox ("Please choose your Transformation")
    End If
    End Sub
    
    Private Sub Command3_Click()
    If Option1.Value = True Then
    converter = pi / 180
    axx.Text = Round(Cos(angle.Text * converter), 2)
    ayx.Text = Sin(angle.Text * converter)
    azx.Text = Round(Cos(angle.Text * converter), 2)
    ac1.Text = 0
    axy.Text = -Sin(angle.Text * converter)
    ayy.Text = Round(Cos(angle.Text * converter), 2)
    azy.Text = Round(Cos(angle.Text * converter), 2)
    ac2.Text = 0
    axz.Text = Round(Cos(angle.Text * converter), 2)
    ayz.Text = Round(Cos(angle.Text * converter), 2)
    azz.Text = Sin(angle.Text * converter)
    ac3.Text = 0
    atransx.Text = Round(Cos(angle.Text * converter), 2)
    atransy.Text = Round(Cos(angle.Text * converter), 2)
    atransz.Text = Round(Cos(angle.Text * converter), 2)
    ac4.Text = 1
    ElseIf Option2.Value = True Then
    converter = pi / 180
    bxx.Text = Round(Cos(angle.Text * converter), 2)
    byx.Text = Sin(angle.Text * converter)
    bzx.Text = Round(Cos(angle.Text * converter), 2)
    bc1.Text = 0
    bxy.Text = -Sin(angle.Text * converter)
    byy.Text = Round(Cos(angle.Text * converter), 2)
    bzy.Text = Round(Cos(angle.Text * converter), 2)
    bc2.Text = 0
    bxz.Text = Round(Cos(angle.Text * converter), 2)
    byz.Text = Round(Cos(angle.Text * converter), 2)
    bzz.Text = Sin(angle.Text * converter)
    bc3.Text = 0
    btransx.Text = Round(Cos(angle.Text * converter), 2)
    btransy.Text = Round(Cos(angle.Text * converter), 2)
    btransz.Text = Round(Cos(angle.Text * converter), 2)
    bc4.Text = 1
    ElseIf Option3.Value = True Then
    converter = pi / 180
    cxx.Text = Round(Cos(angle.Text * converter), 2)
    cyx.Text = Sin(angle.Text * converter)
    czx.Text = Round(Cos(angle.Text * converter), 2)
    cc1.Text = 0
    cxy.Text = -Sin(angle.Text * converter)
    cyy.Text = Round(Cos(angle.Text * converter), 2)
    czy.Text = Round(Cos(angle.Text * converter), 2)
    cc2.Text = 0
    cxz.Text = Round(Cos(angle.Text * converter), 2)
    cyz.Text = Round(Cos(angle.Text * converter), 2)
    czz.Text = Sin(angle.Text * converter)
    cc3.Text = 0
    ctransx.Text = Round(Cos(angle.Text * converter), 2)
    ctransy.Text = Round(Cos(angle.Text * converter), 2)
    ctransz.Text = Round(Cos(angle.Text * converter), 2)
    cc4.Text = 1
    ElseIf Option4.Value = True Then
    converter = pi / 180
    dxx.Text = Round(Cos(angle.Text * converter), 2)
    dyx.Text = Sin(angle.Text * converter)
    dzx.Text = Round(Cos(angle.Text * converter), 2)
    dc1.Text = 0
    dxy.Text = -Sin(angle.Text * converter)
    dyy.Text = Round(Cos(angle.Text * converter), 2)
    dzy.Text = Round(Cos(angle.Text * converter), 2)
    dc2.Text = 0
    dxz.Text = Round(Cos(angle.Text * converter), 2)
    dyz.Text = Round(Cos(angle.Text * converter), 2)
    dzz.Text = Sin(angle.Text * converter)
    dc3.Text = 0
    dtransx.Text = Round(Cos(angle.Text * converter), 2)
    dtransy.Text = Round(Cos(angle.Text * converter), 2)
    dtransz.Text = Round(Cos(angle.Text * converter), 2)
    dc4.Text = 1
    ElseIf Option5.Value = True Then
    converter = pi / 180
    exx.Text = Round(Cos(angle.Text * converter), 2)
    eyx.Text = Sin(angle.Text * converter)
    ezx.Text = Round(Cos(angle.Text * converter), 2)
    ec1.Text = 0
    exy.Text = -Sin(angle.Text * converter)
    eyy.Text = Round(Cos(angle.Text * converter), 2)
    ezy.Text = Round(Cos(angle.Text * converter), 2)
    ec2.Text = 0
    exz.Text = Round(Cos(angle.Text * converter), 2)
    eyz.Text = Round(Cos(angle.Text * converter), 2)
    ezz.Text = Sin(angle.Text * converter)
    ec3.Text = 0
    etransx.Text = Round(Cos(angle.Text * converter), 2)
    etransy.Text = Round(Cos(angle.Text * converter), 2)
    etransz.Text = Round(Cos(angle.Text * converter), 2)
    ec4.Text = 1
    Else
    MsgBox ("Please choose your Transformation")
    End If
    End Sub
    
    Private Sub Command4_Click()
    If Option1.Value = True Then
    converter = pi / 180
    axx.Text = 1
    ayx.Text = 0
    azx.Text = 0
    ac1.Text = 0
    axy.Text = 0
    ayy.Text = 1
    azy.Text = 0
    ac2.Text = 0
    axz.Text = 0
    ayz.Text = 0
    azz.Text = 1
    ac3.Text = 0
    atransx.Text = xgiven.Text
    atransy.Text = ygiven.Text
    atransz.Text = zgiven.Text
    ac4.Text = 1
    ElseIf Option2.Value = True Then
    converter = pi / 180
    bxx.Text = 1
    byx.Text = 0
    bzx.Text = 0
    bc1.Text = 0
    bxy.Text = 0
    byy.Text = 1
    bzy.Text = 0
    bc2.Text = 0
    bxz.Text = 0
    byz.Text = 0
    bzz.Text = 1
    bc3.Text = 0
    btransx.Text = xgiven.Text
    btransy.Text = ygiven.Text
    btransz.Text = zgiven.Text
    bc4.Text = 1
    ElseIf Option3.Value = True Then
    converter = pi / 180
    cxx.Text = 1
    cyx.Text = 0
    czx.Text = 0
    cc1.Text = 0
    cxy.Text = 0
    cyy.Text = 1
    czy.Text = 0
    cc2.Text = 0
    cxz.Text = 0
    cyz.Text = 0
    czz.Text = 1
    cc3.Text = 0
    ctransx.Text = xgiven.Text
    ctransy.Text = ygiven.Text
    ctransz.Text = zgiven.Text
    cc4.Text = 1
    ElseIf Option4.Value = True Then
    converter = pi / 180
    dxx.Text = 1
    dyx.Text = 0
    dzx.Text = 0
    dc1.Text = 0
    dxy.Text = 0
    dyy.Text = 1
    dzy.Text = 0
    dc2.Text = 0
    dxz.Text = 0
    dyz.Text = 0
    dzz.Text = 1
    dc3.Text = 0
    dtransx.Text = xgiven.Text
    dtransy.Text = ygiven.Text
    dtransz.Text = zgiven.Text
    dc4.Text = 1
    ElseIf Option5.Value = True Then
    converter = pi / 180
    exx.Text = 1
    eyx.Text = 0
    ezx.Text = 0
    ec1.Text = 0
    exy.Text = 0
    eyy.Text = 1
    ezy.Text = 0
    ec2.Text = 0
    exz.Text = 0
    eyz.Text = 0
    ezz.Text = 1
    ec3.Text = 0
    etransx.Text = xgiven.Text
    etransy.Text = ygiven.Text
    etransz.Text = zgiven.Text
    ec4.Text = 1
    Else
    MsgBox ("Please choose your Transformation")
    End If
    End Sub
    
    Private Sub Command5_Click()
    'Error
    If axx.Text = "" Then
    MsgBox ("You have no content on your 1st Transformation Matrix")
    Else
    End If
    'Start of Formula
    
    'Hidden
    hxx = (axx * bxx) + (axy * byx) + (axz * bzx) + (atransx * bc1)
    hxy = (axx * bxy) + (axy * byy) + (axz * bzy) + (atransx * bc2)
    hxz = (axx * bxz) + (axy * byz) + (axz * bzz) + (atransx * bc3)
    htransx = (axx * btransx) + (axy * btransy) + (axz * btransz) + (atransx * bc4)
    hyx = (ayx * bxx) + (ayy * byx) + (ayz * bzx) + (atransy * bc1)
    hyy = (ayx * bxy) + (ayy * byy) + (ayz * bzy) + (atransy * bc2)
    hyz = (ayx * bxz) + (ayy * byz) + (ayz * bzz) + (atransy * bc3)
    htransy = (ayx * btransx) + (ayy * btransy) + (ayz * btransz) + (atransy * bc4)
    hzx = (azx * bxx) + (azy * byx) + (azz * bzx) + (atransz * bc1)
    hzy = (azx * bxy) + (azy * byy) + (azz * bzy) + (atransz * bc2)
    hzz = (azx * bxz) + (azy * byz) + (azz * bzz) + (atransz * bc3)
    htransz = (azx * btransx) + (azy * btransy) + (azz * btransz) + (atransz * bc4)
    hc1 = (ac1 * bxx) + (ac2 * byx) + (ac3 * bzx) + (ac4 * bc1)
    hc2 = (ac1 * bxy) + (ac2 * byy) + (ac3 * bzy) + (ac4 * bc2)
    hc3 = (ac1 * bxz) + (ac2 * byz) + (ac3 * bzz) + (ac4 * bc3)
    hc4 = (ac1 * btransx) + (ac2 * btransy) + (ac3 * btransz) + (ac4 * bc4)
    'Third to the Final Textboxes
    ixx = (hxx * cxx) + (hxy * cyx) + (hxz * czx) + (htransx * cc1)
    ixy = (hxx * cxy) + (hxy * cyy) + (hxz * czy) + (htransx * cc2)
    ixz = (hxx * cxz) + (hxy * cyz) + (hxz * czz) + (htransx * cc3)
    itransx = (hxx * ctransx) + (hxy * ctransy) + (hxz * ctransz) + (htransx * cc4)
    iyx = (hyx * cxx) + (hyy * cyx) + (hyz * czx) + (htransy * cc1)
    iyy = (hyx * cxy) + (hyy * cyy) + (hyz * czy) + (htransy * cc2)
    iyz = (hyx * cxz) + (hyy * cyz) + (hyz * czz) + (htransy * cc3)
    itransy = (hyx * ctransx) + (hyy * ctransy) + (hyz * ctransz) + (htransy * cc4)
    izx = (hzx * cxx) + (hzy * cyx) + (hzz * czx) + (htransz * cc1)
    izy = (hzx * cxy) + (hzy * cyy) + (hzz * czy) + (htransz * cc2)
    izz = (hzx * cxz) + (hzy * cyz) + (hzz * czz) + (htransz * cc3)
    itransz = (hzx * ctransx) + (hzy * ctransy) + (hzz * ctransz) + (htransz * cc4)
    ic1 = (hc1 * cxx) + (hc2 * cyx) + (hc3 * czx) + (hc4 * cc1)
    ic2 = (hc1 * cxy) + (hc2 * cyy) + (hc3 * czy) + (hc4 * cc2)
    ic3 = (hc1 * cxz) + (hc2 * cyz) + (hc3 * czz) + (hc4 * cc3)
    ic4 = (hc1 * ctransx) + (hc2 * ctransy) + (hc3 * ctransz) + (hc4 * cc4)
    'Second to the Final Textboxes
    jxx = (ixx * dxx) + (ixy * dyx) + (ixz * dzx) + (itransx * dc1)
    jxy = (ixx * dxy) + (ixy * dyy) + (ixz * dzy) + (itransx * dc2)
    jxz = (ixx * dxz) + (ixy * dyz) + (ixz * dzz) + (itransx * dc3)
    jtransx = (ixx * dtransx) + (ixy * dtransy) + (ixz * dtransz) + (itransx * dc4)
    jyx = (iyx * dxx) + (iyy * dyx) + (iyz * dzx) + (itransy * dc1)
    jyy = (iyx * dxy) + (iyy * dyy) + (iyz * dzy) + (itransy * dc2)
    jyz = (iyx * dxz) + (iyy * dyz) + (iyz * dzz) + (itransy * dc3)
    jtransy = (iyx * dtransx) + (iyy * dtransy) + (iyz * dtransz) + (itransy * dc4)
    jzx = (izx * dxx) + (izy * dyx) + (izz * dzx) + (itransz * dc1)
    jzy = (izx * dxy) + (izy * dyy) + (izz * dzy) + (itransz * dc2)
    jzz = (izx * dxz) + (izy * dyz) + (izz * dzz) + (itransz * dc3)
    jtransz = (izx * dtransx) + (izy * dtransy) + (izz * dtransz) + (itransz * dc4)
    jc1 = (ic1 * dxx) + (ic2 * dyx) + (ic3 * dzx) + (ic4 * dc1)
    jc2 = (ic1 * dxy) + (ic2 * dyy) + (ic3 * dzy) + (ic4 * dc2)
    jc3 = (ic1 * dxz) + (ic2 * dyz) + (ic3 * dzz) + (ic4 * dc3)
    jc4 = (ic1 * dtransx) + (ic2 * dtransy) + (ic3 * dtransz) + (ic4 * dc4)
    'Final Textboxes
    fxx = (jxx * exx) + (jxy * eyx) + (jxz * ezx) + (jtransx * ec1)
    fxy = (jxx * exy) + (jxy * eyy) + (jxz * ezy) + (jtransx * ec2)
    fxz = (jxx * exz) + (jxy * eyz) + (jxz * ezz) + (jtransx * ec3)
    ftransx = (jxx * etransx) + (jxy * etransy) + (jxz * etransz) + (jtransx * ec4)
    fyx = (jyx * exx) + (jyy * eyx) + (jyz * ezx) + (jtransy * ec1)
    fyy = (jyx * exy) + (jyy * eyy) + (jyz * ezy) + (jtransy * ec2)
    fyz = (jyx * exz) + (jyy * eyz) + (jyz * ezz) + (jtransy * ec3)
    ftransy = (jyx * etransx) + (jyy * etransy) + (jyz * etransz) + (jtransy * ec4)
    fzx = (jzx * exx) + (jzy * eyx) + (jzz * ezx) + (jtransz * ec1)
    fzy = (jzx * exy) + (jzy * eyy) + (jzz * ezy) + (jtransz * ec2)
    fzz = (jzx * exz) + (jzy * eyz) + (jzz * ezz) + (jtransz * ec3)
    ftransz = (jzx * etransx) + (jzy * etransy) + (jzz * etransz) + (jtransz * ec4)
    fc1 = (jc1 * exx) + (jc2 * eyx) + (jc3 * ezx) + (jc4 * ec1)
    fc2 = (jc1 * exy) + (jc2 * eyy) + (jc3 * ezy) + (jc4 * ec2)
    fc3 = (jc1 * exz) + (jc2 * eyz) + (jc3 * ezz) + (jc4 * ec3)
    fc4 = (jc1 * etransx) + (jc2 * etransy) + (jc3 * etransz) + (jc4 * ec4)
    End Sub
    i am really sorry, i think you are having a hard time on understanding my program.. The problem is, when one frame with 4x4 textboxes are left unfilled by values, the error occurs.. That's why i am planning to make hidden values on textboxes so in case the user left no value on one frame, the program will not be affected by the error. I hope you can now understand T_T
    Last edited by lloydi12345; March 5th, 2010 at 09:01 AM.

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: How to set values for textboxes that is not visible

    Instead of using the value of a textbox directly, you use it via a function which can supply a default value, or before using the textboxes you check if they are empty and put the default value in.
    As for a default function:
    Code:
    Private Function TextBoxValue(TBox as TextBox, DefaultValue as Variant) as Variant
      If TBox.Text = "" Then TextBoxValue = DefaultValue Else TextBoxValue = Val(TBox.Text)
    End Function
    I left the data type Variant so as any type of default value can be returned
    You use the function wherever an "endangered TextBox" is used.
    like myVar = TextBoxValue(Textx, 0)
    myVar will receive 0 if the textbox is empty.

  6. #6
    Join Date
    Feb 2010
    Posts
    16

    Re: How to set values for textboxes that is not visible

    Quote Originally Posted by WoF View Post
    Instead of using the value of a textbox directly, you use it via a function which can supply a default value, or before using the textboxes you check if they are empty and put the default value in.
    As for a default function:
    Code:
    Private Function TextBoxValue(TBox as TextBox, DefaultValue as Variant) as Variant
      If TBox.Text = "" Then TextBoxValue = DefaultValue Else TextBoxValue = Val(TBox.Text)
    End Function
    I left the data type Variant so as any type of default value can be returned
    You use the function wherever an "endangered TextBox" is used.
    like myVar = TextBoxValue(Textx, 0)
    myVar will receive 0 if the textbox is empty.
    Thanks sir WOF, i'll try it

  7. #7
    Join Date
    Feb 2010
    Posts
    16

    Unhappy Re: How to set values for textboxes that is not visible

    sir i have tried it and placed this private function on the top most of my program codes, i used it on some of my boxes which is axx.text, axy,text, axz.text and atransx.text

    Code:
    Private Function TextBoxValue(TBox As TextBox, DefaultValue As Variant) As Variant
    If axx.Text = " " Then
    TextBoxValue = DefaultValue
    Else: TextBoxValue = Val(axx.Text)
    TextBoxValue = Val(axy.Text)
    TextBoxValue = Val(axz.Text)
    TextBoxValue = Val(atransx.Text)
    End Function
    i tried placing values on my bxy.text and left blank on my axy.text...atrans.text

    but still i am having an error on this line

    Code:
    hxx = (axx * bxx) + (axy * byx) + (axz * bzx) + (atransx * bc1)
    Last edited by lloydi12345; March 5th, 2010 at 08:36 PM.

  8. #8
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,324

    Re: How to set values for textboxes that is not visible

    You are only checking one of the boxes and you are checking to see if it is equal to a space. A blank text box will not be detected. The other boxes are not checked and therefore leave holes in your code.

    I would not use Variant types here at all rather a string variable as we are looking for the text property.

    I also would not pass the textbox to the function but the content of the text box instead.

    If I were to use a function for this I would simply pass the text from the control and the default value and then return the proper value.
    Code:
    TextBox1.Text=GetVaild(TextBox1.Text,"1")
    The line above would be used for each textbox

    The function called would be something like
    Code:
    Function GetValid(DataString as string, DefaultValue as string) as String
    If Trim(DataString)="" then
        GetVaild=DefaultValue
    Else
        GetValid=DataString
    End If
    Of course I would most likely use a textbox array and just loop through them before processing.

    As for attaching a value to a text box that will not be visible you can use the tag property but you still have to write code to place it in the text property or use tag instead at the time of processing.

    In the case of a control array it is pretty simple. Lets say there are 10 text boxes all of which have the tag property set to the required default value and need to be checked.

    Code:
      Dim X as integer
      For x = 0 to 9
        If Trim(text1(x).text)="" then Text1(x).text=Text1(x).Tag
      Next

  9. #9
    Join Date
    Feb 2010
    Posts
    16

    Thumbs up Re: How to set values for textboxes that is not visible

    Quote Originally Posted by DataMiser View Post
    You are only checking one of the boxes and you are checking to see if it is equal to a space. A blank text box will not be detected. The other boxes are not checked and therefore leave holes in your code.

    I would not use Variant types here at all rather a string variable as we are looking for the text property.

    I also would not pass the textbox to the function but the content of the text box instead.

    If I were to use a function for this I would simply pass the text from the control and the default value and then return the proper value.
    Code:
    TextBox1.Text=GetVaild(TextBox1.Text,"1")
    The line above would be used for each textbox

    The function called would be something like
    Code:
    Function GetValid(DataString as string, DefaultValue as string) as String
    If Trim(DataString)="" then
        GetVaild=DefaultValue
    Else
        GetValid=DataString
    End If
    Of course I would most likely use a textbox array and just loop through them before processing.

    As for attaching a value to a text box that will not be visible you can use the tag property but you still have to write code to place it in the text property or use tag instead at the time of processing.

    In the case of a control array it is pretty simple. Lets say there are 10 text boxes all of which have the tag property set to the required default value and need to be checked.

    Code:
      Dim X as integer
      For x = 0 to 9
        If Trim(text1(x).text)="" then Text1(x).text=Text1(x).Tag
      Next
    before, i really would like to use array but because i don't have idea how to start i choose this way.. now i know little things about arrays with your reply, thank you datamiser xD i'll now give it a shot

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to set values for textboxes that is not visible

    If your data were only this big:

    axx.Text = Sin(angle.Text * converter)
    ayx.Text = Round(Cos(angle.Text * converter), 2)
    azx.Text = Round(Cos(angle.Text * converter), 2)
    ac1.Text = 0
    axy.Text = Round(Cos(angle.Text * converter), 2)
    ayy.Text = Round(Cos(angle.Text * converter), 2)
    azy.Text = Sin(angle.Text * converter)
    ac2.Text = 0


    Looks like you have 4 erlements in the array, and in this case, 2 items.
    While you can store a 2-dimensional array both ways, it's better to declare it the way it's going to be used.

    In this case:
    Code:
    Dim txt(1,3) as String ' arrays start with (0,0)
    So, a loop thru:
    Code:
    Dim r as Integer, c a Integer
    for r = 0 to Ubound(txt,1) - 1
      for c = 0 to Ubound(txt,2) - 1
        msgbox(txt(r,c))
      next c
    next r
    Last edited by dglienna; March 6th, 2010 at 05:59 PM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)