Results 1 to 5 of 5

Thread: combobox indexchanged

  1. #1
    Join Date
    Sep 2013
    Posts
    10

    combobox indexchanged

    Hi

    when I select from a comboxbox or list box nothing happens, although I have set the selecetedindexchanged sub.
    to get the index change to execute I added a button command.
    is there anyway to get the indexchanged to execute when I select from the combobox without having to use the button?

  2. #2
    Join Date
    Dec 2007
    Posts
    2,291

    Re: combobox indexchanged

    Have you got the SelectedIndexChanged event handler? Can you tell us how does the code know what to do for anything once the selection has been made or so?

  3. #3
    Join Date
    Sep 2013
    Posts
    10

    Re: combobox indexchanged

    I did use the SelectedIndexChanged event handler but it only execute when I press a button I added.

    I have an access database that has 2 tables in it:
    - Category (categoryid autonumber/primary key and desription as text)
    - details (detid primary,autonumbered - categoryid - client name - video name.mp4)

    The mp4s exist in directory "clips" and the database directory "data"

    I am working with visual web developer 2010 express.
    I created a visual basic webform (main.aspx)
    I added a combobox to main called it cmbCatergory that displays description field from category table and categoryid as data field value.
    I created a text box (hcono) to store the value of the combo in it (SelectedIndexChanged event handler).
    the handler does not fire unless I perss a button I added (goButton).

    then I added a listbox called lstCleint.
    when I click the goButton the client names show in lstClient. and it is working fine.

    now I have two problems
    1- The SelectedIndexChanged for combobox and listbox do not work unless I press the goButton and I want it to fire whenever the index changes.
    2- I want to play 'on the same page' the mp4 video of the selection from the listbox. (I do retrieve the name of the file and store it in a variable).

    How can I solve these two problems?

  4. #4
    Join Date
    Dec 2007
    Posts
    1,736

    Re: combobox indexchanged

    Can you try to work around it by simply delaying the action until the event handler has stopped running, check the below code for example:

    Code:
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
          this.BeginInvoke(new MethodInvoker(delayedIndexChanged));
        }
        private void delayedIndexChanged() {
          MessageBox.Show("yada");
        }

  5. #5
    Join Date
    Sep 2013
    Posts
    10

    Re: combobox indexchanged

    Hi

    I tied your suggestion but it didnt work.
    because I am working with visual web developer VB not c#. I
    created a sub that displays a message box
    and I called it from the SelectedIndexChanged but it doesnt execute unless I click the button.

Similar Threads

  1. Need Help With ComboBox
    By Reyas in forum Software Development
    Replies: 1
    Last Post: 29-04-2012, 12:53 PM
  2. Use of combobox in script
    By Martien in forum Software Development
    Replies: 3
    Last Post: 15-01-2010, 11:58 AM
  3. Combobox and Text value
    By HarshaB in forum Software Development
    Replies: 5
    Last Post: 09-11-2009, 07:16 PM
  4. How to lock combobox
    By JamesB in forum Software Development
    Replies: 3
    Last Post: 19-03-2009, 07:20 PM
  5. Add ComboBox in DataGrid in VB 6.0
    By Jateen in forum Software Development
    Replies: 3
    Last Post: 15-01-2009, 06:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,483,670.40918 seconds with 17 queries