473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

combobox.SelectedIndexChanged fires twice ??

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
Nov 21 '05 #1
2 3894
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

Nov 21 '05 #2
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

"Mohamoss" <mo************@egdsc.microsoft.com> wrote in message
news:ES**************@cpmsftngxa10.phx.gbl...
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ceci | last post by:
I need help!! I'm using the selectedindexchanged event of a combobox to fill another combobox according to the selected value of the first one, but the combobox_selectedindexchanged happens twice...
0
by: Anthony | last post by:
is there a way to stop combox from firing SelectedIndexChanged events on loading when it is databinded? everytime my form loads, SelectedIndexChanged fires 4 times? using System; using...
3
by: ScottO | last post by:
I would like the user to have to select something in a System.Windows.Forms.ComboBox. private void MyForm_Load(object sender, System.EventArgs e) { ... comboBox.DataSource = data;...
7
by: sparkle | last post by:
Hi Everybody, I'm filling a combobox from a class, which works fine on it's own. But when I insert code to fill in other controls something in the combobox fill is causing the...
2
by: blue_nirvana | last post by:
I use a AddHandler statement in the load event of a form to assoicate a routine with a combobox. When I populate the form, I select the approiate value from the combobox by using...
4
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList...
3
by: Alec MacLean | last post by:
Hi, I have a couple of win forms where I am editing values that are stored in a SQL database. I'm using the listbox control to hold the data object each form interacts with. Each object is...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
4
by: somacore | last post by:
Quick question, Is there a way to preserve the value in my combobox when it fires a SelectedIndexChanged event? Right now I have 4 comboboxes all linked together with an SQL query: Site...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.