Problem with accessing other form variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shailja
    New Member
    • Feb 2007
    • 123

    Problem with accessing other form variable

    I have 2 form in my VB Project. One is frmSales and other is frmNew.

    Now in frmSales form, I have declared one variable as
    public cmdUpdate as Integer.

    I want to check the value of variable (cmdUpdate) in frmNew form.
    I have written following code in frmNew form

    Dim frmobj as New frmSales
    if frmSales.cmdUpd ate = 1
    code
    else if

    But above code does not work. I am not able to access the cmdUpdate variable.
    Can anyone tell me what is wrong in my code.

    Thanks
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by Shailja
    I have 2 form in my VB Project. One is frmSales and other is frmNew.

    Now in frmSales form, I have declared one variable as
    public cmdUpdate as Integer.

    I want to check the value of variable (cmdUpdate) in frmNew form.
    I have written following code in frmNew form

    Dim frmobj as New frmSales
    if frmSales.cmdUpd ate = 1
    code
    else if

    But above code does not work. I am not able to access the cmdUpdate variable.
    Can anyone tell me what is wrong in my code.

    Thanks
    it may be in
    Dim frmobj as New frmSales
    if frmSales.cmdUpd ate = 1
    use frmobj insted of frmsales

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Have you checked that it really does have the value of 1 at that time?

      Comment

      Working...