473,396 Members | 1,706 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,396 software developers and data experts.

ComboBox dropdown flickering in windows application C#.net 2005

99
My application contains 2 tabpages.The second tabpage contains panel .The panel contains series of combobox and textboxes.

If the item not selected in combobox and the user click on the another tabpage,it should show "The option from dropdown should be selected" and focus the combo .I have did this in validating event

void cmbDistributionOption_Validating(object sender, CancelEventArgs e)
{
ComboBox cmb = (ComboBox)sender;
if (cmb.SelectedIndex <= 0)
{
MessageBox.Show("The option from dropdown should be selected.", "Popup", MessageBoxButtons.OK);
e.Cancel = true;



}
}
it works fine till focusing the combo.If I again try to select the combo which is focused,the dropdown of the combo is flickering(dropdown shows and goes up)
I tried to select the item but its not possible.

Any solution for this weird behaviour?
Jun 22 '07 #1
2 5017
Vidhura
99
My application contains 2 tabpages.The second tabpage contains panel .The panel contains series of combobox and textboxes.

If the item not selected in combobox and the user click on the another tabpage,it should show "The option from dropdown should be selected" and focus the combo .I have did this in validating event



it works fine till focusing the combo.If I again try to select the combo which is focused,the dropdown of the combo is flickering(dropdown shows and goes up)
I tried to select the item but its not possible.

Any solution for this weird behaviour?

plz Anyone help me on this?
Jun 22 '07 #2
Vidhura
99
Finally I have found the solution for this issue.

May be it help someone,so I m posting the solution for this

Issue:

My application contains 2 tabpages.The second tabpage contains panel .
The panel contains series of combobox and textboxes.
If the item not selected in combobox and the user click on the another tabpage,
it should show "The option from dropdown should be selected" and focus the combo .

I have did this using e.cancel= true in combobox_validating event (which have been wrong)
it works fine till focusing the combo.If I again try to select the combo which is focused,the dropdown of the combo is flickering(dropdown shows and goes up)
I tried to select the item but its not possible.


Solution:

When you need this kind of functionality in tabpages please dont put it in controls validating event.
because after all this, the controls events are not firing(Mouse events,click events)


Instead set value to the variable,and do the e.cancel= true in tabcontrol_selecting event.


Expand|Select|Wrap|Line Numbers
  1. public  bool cancel = false;
  2.  
  3.  void Combobox_Validating(object sender, CancelEventArgs e)
  4.  {     
  5.  
  6.            if (Combox.selectedindex <=0 )
  7.             {
  8.                MessageBox.Show("This is required field. Please enter value(s).", "Popup", MessageBoxButtons.OK);     
  9.                cancel = true;
  10.              }
  11.             else
  12.             {               
  13.                cancel = false;
  14.             }
  15.  
  16.  }
  17.  
  18.  
  19.  
  20.  void tabCtrl_Selecting(object sender, System.Windows.Forms.TabControlCancelEventArgs e)
  21.  {
  22.          if (cancel == true)
  23.          {
  24.             e.Cancel = true;
  25.          }
  26.  }
Jul 3 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jean | last post by:
hi: i am developing a custom combobox for my company's needs that is made up of a textbox, listbox, button. i am using c#. everything is fine except for one issue. in a normal combobox,...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
3
by: Brian Henry | last post by:
Is there anyway to prevent the white box that drops down when you do a combobox dropdown from showing? I am trying to make a custom combobox which requires showing a custom form in its place, but...
4
by: Kalvin | last post by:
I have seen this question raised, but I cannot find an answer. I have an MDI app, when I load an child form with a combobox being bound in the load event, it won't allow me to set selectedindex =...
0
by: | last post by:
Hi All. I have a problem with combobox, what I want is when combobox gets focus I need it to show the dropdown list t.This is fine if the user selects the combobox via keystrokes but when the...
1
by: amber | last post by:
I'm having an issue with a combobox that is making no sense to me at all. I have a form with several comboboxes/textboxes. The values in these boxes are based on a datarowview, which is based on...
6
by: Mark Thompson | last post by:
I have a problem with my Visual Basic .NET 2003 application which I have so far been unable to resolve. I am trying to get an OpenGL control that I have created working properly as a control on...
10
by: Academia | last post by:
I'm making my own ComboBox and would like the DropDown button to look like the system combo box. Do you know the Font for the "v" that is used in the regular combobox. Is that the letter vee...
2
by: Andrus | last post by:
SWF DataGridView contains combobox control. Activating combobox and pressing F4 to open dropdown menu causes strange NRE (see below). When I enter some valid value to combobox, press tab,...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.