Simulate Click-Event in ComboBox

Discussion in 'Microsoft VB .NET' started by DraguVaso, Mar 29, 2004.

  1. DraguVaso

    DraguVaso Guest

    Hi,

    I'm having a DataGrid with a Combobox bound to it. When I enter a
    DataGridCell the comboBox is shown. BUT, to typ something in it or scroll
    through the ComoBox-Items I have to click a second time in it.

    Now my queqtion is: how can I kind of 'simulate' the Click in that ComboBox,
    so that, on the moment the users enters the cell (by MouseClick or Tab-Key),
    the second clikc is done automatically?

    Anybody got any idea?

    Thanks!

    Pieter
     
    DraguVaso, Mar 29, 2004
    #1
    1. Advertisements

  2. DraguVaso

    yEah rIgHt Guest

    call this: ComboBox1_Click(sender, New System.EventArgs())



    DraguVaso wrote:
    > Hi,
    >
    > I'm having a DataGrid with a Combobox bound to it. When I enter a
    > DataGridCell the comboBox is shown. BUT, to typ something in it or scroll
    > through the ComoBox-Items I have to click a second time in it.
    >
    > Now my queqtion is: how can I kind of 'simulate' the Click in that ComboBox,
    > so that, on the moment the users enters the cell (by MouseClick or Tab-Key),
    > the second clikc is done automatically?
    >
    > Anybody got any idea?
    >
    > Thanks!
    >
    > Pieter
    >
    >
     
    yEah rIgHt, Mar 29, 2004
    #2
    1. Advertisements

  3. DraguVaso

    DraguVaso Guest

    It's not calling the function that I need, but really simulating the Click:
    The ComboBox doesn't get the right focus until the user clicks on it. Waht I
    need is that I can give it automaticly the focus. The method ComboBox.Focus
    doesn't work: The CombobBox gets the focus, but it's still not the same like
    when the user clicks in it :-/

    "yEah rIgHt" <> wrote in message
    news:...
    >
    > call this: ComboBox1_Click(sender, New System.EventArgs())
    >
    >
    >
    > DraguVaso wrote:
    > > Hi,
    > >
    > > I'm having a DataGrid with a Combobox bound to it. When I enter a
    > > DataGridCell the comboBox is shown. BUT, to typ something in it or

    scroll
    > > through the ComoBox-Items I have to click a second time in it.
    > >
    > > Now my queqtion is: how can I kind of 'simulate' the Click in that

    ComboBox,
    > > so that, on the moment the users enters the cell (by MouseClick or

    Tab-Key),
    > > the second clikc is done automatically?
    > >
    > > Anybody got any idea?
    > >
    > > Thanks!
    > >
    > > Pieter
    > >
    > >
     
    DraguVaso, Mar 30, 2004
    #3
  4. DraguVaso

    DraguVaso Guest

    Well, I wasn't really correct:
    when I use the ComboBox.Focus: the ComboBox disappears and the underlying
    GridCell is visible and gets the Focus.... really weird in my opinion...
    Maybe there is something there that worked bad...?

    This is the code I used:
    Dim cb As New System.Drawing.Rectangle 'cell bounds
    cboGrid.DataSource = Nothing
    cboGrid.Text = Nothing

    Dim strText As String
    strText = dbgMulti.Item(dbgMulti.CurrentRowIndex, intColumn)

    cb = dbgMulti.GetCellBounds(dbgMulti.CurrentRowIndex,
    intColumn)
    cboGrid.Location = New Point(cb.X, cb.Y)
    cboGrid.Size = New Size(cb.Width, cb.Height)
    cboGrid.BringToFront()
    cboGrid.Tag = "Open"
    cboGrid.Show()

    Try
    'opvullen
    cboGrid.DataSource = dtsMulti.Tables("tblTitles")
    cboGrid.DisplayMember = "ContactTitle"
    'oorspronkelijke waarde er inzetten
    cboGrid.Text = strText
    Catch

    End Try

    cboGrid.Focus()
    cboGrid.BringToFront()


    "DraguVaso" <> wrote in message
    news:...
    > It's not calling the function that I need, but really simulating the

    Click:
    > The ComboBox doesn't get the right focus until the user clicks on it. Waht

    I
    > need is that I can give it automaticly the focus. The method

    ComboBox.Focus
    > doesn't work: The CombobBox gets the focus, but it's still not the same

    like
    > when the user clicks in it :-/
    >
    > "yEah rIgHt" <> wrote in message
    > news:...
    > >
    > > call this: ComboBox1_Click(sender, New System.EventArgs())
    > >
    > >
    > >
    > > DraguVaso wrote:
    > > > Hi,
    > > >
    > > > I'm having a DataGrid with a Combobox bound to it. When I enter a
    > > > DataGridCell the comboBox is shown. BUT, to typ something in it or

    > scroll
    > > > through the ComoBox-Items I have to click a second time in it.
    > > >
    > > > Now my queqtion is: how can I kind of 'simulate' the Click in that

    > ComboBox,
    > > > so that, on the moment the users enters the cell (by MouseClick or

    > Tab-Key),
    > > > the second clikc is done automatically?
    > > >
    > > > Anybody got any idea?
    > > >
    > > > Thanks!
    > > >
    > > > Pieter
    > > >
    > > >

    >
    >
     
    DraguVaso, Mar 30, 2004
    #4
  5. DraguVaso

    DraguVaso Guest

    AAAAAargh, I just found it myself! I was able to give the ComboBox the Focus
    by setting the DataGridCell.enabled = false!

    Hehehe happy I found it :)

    "DraguVaso" <> wrote in message
    news:...
    > Well, I wasn't really correct:
    > when I use the ComboBox.Focus: the ComboBox disappears and the underlying
    > GridCell is visible and gets the Focus.... really weird in my opinion...
    > Maybe there is something there that worked bad...?
    >
    > This is the code I used:
    > Dim cb As New System.Drawing.Rectangle 'cell bounds
    > cboGrid.DataSource = Nothing
    > cboGrid.Text = Nothing
    >
    > Dim strText As String
    > strText = dbgMulti.Item(dbgMulti.CurrentRowIndex,

    intColumn)
    >
    > cb = dbgMulti.GetCellBounds(dbgMulti.CurrentRowIndex,
    > intColumn)
    > cboGrid.Location = New Point(cb.X, cb.Y)
    > cboGrid.Size = New Size(cb.Width, cb.Height)
    > cboGrid.BringToFront()
    > cboGrid.Tag = "Open"
    > cboGrid.Show()
    >
    > Try
    > 'opvullen
    > cboGrid.DataSource = dtsMulti.Tables("tblTitles")
    > cboGrid.DisplayMember = "ContactTitle"
    > 'oorspronkelijke waarde er inzetten
    > cboGrid.Text = strText
    > Catch
    >
    > End Try
    >
    > cboGrid.Focus()
    > cboGrid.BringToFront()
    >
    >
    > "DraguVaso" <> wrote in message
    > news:...
    > > It's not calling the function that I need, but really simulating the

    > Click:
    > > The ComboBox doesn't get the right focus until the user clicks on it.

    Waht
    > I
    > > need is that I can give it automaticly the focus. The method

    > ComboBox.Focus
    > > doesn't work: The CombobBox gets the focus, but it's still not the same

    > like
    > > when the user clicks in it :-/
    > >
    > > "yEah rIgHt" <> wrote in message
    > > news:...
    > > >
    > > > call this: ComboBox1_Click(sender, New System.EventArgs())
    > > >
    > > >
    > > >
    > > > DraguVaso wrote:
    > > > > Hi,
    > > > >
    > > > > I'm having a DataGrid with a Combobox bound to it. When I enter a
    > > > > DataGridCell the comboBox is shown. BUT, to typ something in it or

    > > scroll
    > > > > through the ComoBox-Items I have to click a second time in it.
    > > > >
    > > > > Now my queqtion is: how can I kind of 'simulate' the Click in that

    > > ComboBox,
    > > > > so that, on the moment the users enters the cell (by MouseClick or

    > > Tab-Key),
    > > > > the second clikc is done automatically?
    > > > >
    > > > > Anybody got any idea?
    > > > >
    > > > > Thanks!
    > > > >
    > > > > Pieter
    > > > >
    > > > >

    > >
    > >

    >
    >
     
    DraguVaso, Mar 30, 2004
    #5
  6. DraguVaso

    Tim Miltz

    Joined:
    Apr 3, 2015
    Likes Received:
    0
    Yeah Right - Thanks SO much for that reply- That NEW EventArgs is what I have been looking for - FINALLY...
     
    Tim Miltz, Apr 3, 2015
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. trevor

    combobox click event not fired

    trevor, Oct 21, 2003, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    462
    Herfried K. Wagner [MVP]
    Oct 21, 2003
  2. DDF

    MSOUTLOOK TASK simulate

    DDF, Oct 29, 2003, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    194
    Jay B. Harlow [MVP - Outlook]
    Oct 29, 2003
  3. active
    Replies:
    1
    Views:
    725
    Herfried K. Wagner [MVP]
    Nov 26, 2003
  4. Maileen

    simulate an event

    Maileen, Aug 8, 2005, in forum: Microsoft VB .NET
    Replies:
    3
    Views:
    305
    Herfried K. Wagner [MVP]
    Aug 9, 2005
  5. Hardik Shah

    Right click event on ComboBox

    Hardik Shah, Dec 20, 2005, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    582
    Hardik Shah
    Dec 21, 2005
  6. Guest
    Replies:
    0
    Views:
    483
    Guest
    Feb 25, 2006
  7. Glenn Palomar

    How to simulate mouse click in vb.net

    Glenn Palomar, May 6, 2006, in forum: Microsoft VB .NET
    Replies:
    3
    Views:
    6,037
    Herfried K. Wagner [MVP]
    May 8, 2006
  8. Replies:
    1
    Views:
    448
    Andrew Morton
    Dec 6, 2006
Loading...