Results 1 to 8 of 8

Thread: Enabling toolbar buttons [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Post Enabling toolbar buttons [RESOLVED]

    HeY All wonder if you can shed some light on this one

    I have a parent MDI form called MainApp
    contained within this MainApp is a public function which simply gets passed an int ie 1,2,3,4 etc
    then i have a case statment like
    select case blah(ByVal MyValue)

    case 1
    Me.MasterBar.Buttons(0).Enabled = True
    case 2
    Me.MasterBar.Buttons(1).Enabled = False
    etc

    I am calling this function from a form called frmLogin like this
    frmMainApp.DoLogin(IntUserPriv)

    the frmMainApp is defined in a module as a public global variable
    So basically my app opens the main MDI parent and that has onLoad event for frmLogin when user logs in all the checks and stuff is done in the frmLogin and if everything is cool the function doLogin is called with their user type passed in, i know the user type is being passed ok because stick a msgbox in there to test it however it will not set the buttons to either be enabled or disabled,,,, any ideas ????
    Last edited by carlblanchard; Sep 24th, 2003 at 06:59 AM.
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Are you sure that frmMainApp is pointing to the form? It's an easy mistake to have two forms loaded and only one visible - very confusing!

    Can you post your project (or, better, a prototype that just has the bit that doesn't work)?
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    ok this is whats happening

    I have a main MDIParent that opens a child onload Login form.
    the log in form does what it needs to do then passed a ref back to a public function on the MDIParent

    this is the function including test crap so excuse the crap

    Public Function DoLogin(ByVal MyValue)
    'Function to highlight the required toolbars

    Select Case MyValue
    Case 0
    btnLoginout.Enabled = True
    MsgBox("Case found 0")
    Case 1
    btnLoginout.Enabled = True
    MsgBox("Case found 1")
    Case 2
    btnLoginout.Enabled = True
    MsgBox("Case found 2")
    Case 3
    btnLoginout.Enabled = True
    MsgBox("Case found 3")
    Case 4
    btnLoginout.Enabled = True
    MsgBox("Case found 4")
    Case 5
    btnLoginout.Enabled = True
    MsgBox("Case found 5")
    Case Else
    MsgBox("Sorry cant determin your rights to access this software, Please call tech support on " & strTelephone & "")
    End Select

    End Function

    shed any light on this one ????
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  4. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    No, can't see what the problem is from what you've posted.

    Zip up the whole project and post it and I'll work out a solution.
    This world is not my home. I'm just passing through.

  5. #5

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    as attached

    its not the project im working on but its the same problem
    Attached Files Attached Files
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  6. #6
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Like I was suggesting - frm1 was a new instance of Form1, it wasn't pointing to the Form1 that was displayed.

    In Module 1 change the code to this:
    VB Code:
    1. Public frm1 As Form1

    In the Form1_Load subroutine add this as the first line:
    VB Code:
    1. frm1 = Me

    This should sort out the problem. Let me know...
    This world is not my home. I'm just passing through.

  7. #7

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    cheers buddy

    cheers buddy that works in my demo i sent you
    however in my actully project it dosnt ?

    is there a way to see which from is actully loaded ?
    if so how
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  8. #8

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    its ok found it

    my book advised me to stick frm1 = me after InitializeComponent()
    in the windows generated code so i commented that out and it worked fine

    THANKS loads for your help mate


    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()
    'frmMainApp = Me
    End Sub
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

Posting Permissions

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



Click Here to Expand Forum to Full Width