PC Review


Reply
Thread Tools Rate Thread

Simulate Click-Event in ComboBox

 
 
DraguVaso
Guest
Posts: n/a
 
      29th Mar 2004
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


 
Reply With Quote
 
 
 
 
yEah rIgHt
Guest
Posts: n/a
 
      29th Mar 2004

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
>
>

 
Reply With Quote
 
 
 
 
DraguVaso
Guest
Posts: n/a
 
      30th Mar 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
> >
> >



 
Reply With Quote
 
DraguVaso
Guest
Posts: n/a
 
      30th Mar 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > 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
> > >
> > >

>
>



 
Reply With Quote
 
DraguVaso
Guest
Posts: n/a
 
      30th Mar 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > >
> > > 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
> > > >
> > > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Need a utility that will simulate logon activity in my domain. Need to simulate logons / audit failures for reporting purposes Pegasus \(MVP\) Windows XP General 0 2nd Mar 2006 10:49 PM
simulate network cable unplugged Antoine Windows XP Networking 6 20th Sep 2004 02:20 AM
simulate network cable unplugged Antoine Windows XP Help 1 17th Sep 2004 04:06 AM
Simulate Click-Event in Combobox DraguVaso Microsoft Dot NET Framework Forms 0 29th Mar 2004 02:52 PM
remote desktop simulate ctrl-alt-del ? John A Grandy Windows XP Networking 2 29th Jan 2004 12:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.