combobox.SelectedIndexChanged fires twice ??

  • Thread starter Thread starter Steve F.
  • Start date Start date
S

Steve F.

I have a problem. I use a combobox in my datagrid, but I noticed, as soon as
the user clicks on the field where the combobox, the event fires with a
index value of 0, then of course with the selected index value as it should.

But why is it firing the first time. How do I make it stop. Please advice.
Thank You,

Steve
http://www.ItsMoreThanSoftware.com
 
Hi steve
Is it webfrom or windows form, would you post a snippet of your code ?
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Windows form, and here is some code. Thank you for your help.

Private Sub mycombo2_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mycombo2.SelectedIndexChanged
IDvalue = Me.DG_punch.Item(Me.DG_punch.CurrentRowIndex, 1)

If mycombo2.Text = "Closed" Then
Dim currentCell As DataGridCell
Dim currentCellData As String
currentCell = DG_punch.CurrentCell
currentCell.ColumnNumber = 8
DG_punch(currentCell.RowNumber, currentCell.ColumnNumber) = Now

Else
Dim currentCell As DataGridCell
Dim currentCellData As String
currentCell = DG_punch.CurrentCell
currentCell.ColumnNumber = 8
DG_punch(currentCell.RowNumber, currentCell.ColumnNumber) =
System.DBNull.Value

End If

Steve
 

Ask a Question

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. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top