Results 1 to 4 of 4

Thread: a Tricky problem about Enabled = true/False - Needs Experience

  1. #1

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    a Tricky problem about Enabled = true/False - Needs Experience

    hi all,


    I am using a listbox on a windows form to get a list of clients, when i user click on an item it should retrieve the summary of all his invoices ( so it takes some time). I am disabling the form so that user can never click on a client before finishing the previous data retrieval , so my code is like the following:


    VB Code:
    1. 'in the list1.selectedindexchanged event
    2.  
    3. me.enabled = false
    4. '''''open datareader
    5. '''''retrieve data
    6. '''''close datareader
    7. me.enabled = true


    it works very very fine, except for one thing.

    when i click an item with the mouse, it works great but !! when i try to navigate the items in the list by using Arrows it doesn't change the selected item. i suppose that is because of the disabling of the form. So how can i force changing of selected item before applying ( me.enabled = false)


    THX in Advance


    BST RGDS

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    I'm not sure I understand correctly. Do you want to update the screen or does the event not fire?

    If you only want to update the display you should add a Me.Refresh before disabling the form.

    The event should fire regardless of you use mouse or keyboard (but there's a good chance that the event fires before the display is updated when using arrowkeys)
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    isnt it the case that because the form is disabled that all the controls on the form should also be disabled, You should even be able to click it with the mouse.
    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

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040
    for the first answer, i used the refresh and / or Update method of the listbox before disabling the form but nothing changed , It just accepts mouse clicks and does not respond to arrow keys.

    I am sure the problem is in ( me.enabled = false) because soon as i remove it, everything goes ok.


    Regarding the
    isnt it the case that because the form is disabled that all the controls on the form should also be disabled, You should even be able to click it with the mouse.
    please let me remind you that i disable the form after the selectedindexchanged Event , and so the user has already the ability to click. the control is not disabled before clicking or keypressing.

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