473,785 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox dropdown flickering in windows application C#.net 2005

99 New Member
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 cmbDistribution Option_Validati ng(object sender, CancelEventArgs e)
{
ComboBox cmb = (ComboBox)sende r;
if (cmb.SelectedIn dex <= 0)
{
MessageBox.Show ("The option from dropdown should be selected.", "Popup", MessageBoxButto ns.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(drop down 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 5062
Vidhura
99 New Member
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(drop down 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 New Member
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_valida ting 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(drop down 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_sele cting 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
2065
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, when the dropdown is visible and the user clicks anywhere else, the dropdown gets hidden. i am trying to replicate this behavior and have tried using the Leave and LostFocus events. i have had marginal success when my dropdown is visible and i...
2
4334
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 how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
3
3083
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 the white box shows up still ontop of the new form that is taking its palce even though there is no items in the white box. Any windows messages or anything you can trap or whatnot? thanks!
4
2448
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 = -1. If it isn't an mdi child, then there isn't a problem. I have tried setting it to -1 two times. I have tried setting the selecteditem property to -1 and also to nothing. None of it seems to make a difference. Any help will be appreciated.
0
1482
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 combobox is selected via mouse click it draws the dropdown list twice. As I am trapping the enter event, I can see thats is called as well some other ? the style is set to dropdownlist as they must select one from the list I assume I must trap a...
1
2075
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 a listbox.selecteditem. When a different item is selected in the listbox, all the fields are repopulated with the correct data. I have 1 combobox which is acting weird.
6
3639
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 my main form in my VB.NET application. It does work and render correctly but the problem is that there is an awful flickering that happens on most PCs I try it on. The flickering is reminiscent of the sort that you get on a TV when it is not tuned...
10
3295
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 or some other character? I think I can use the system button face color. Is that correct?
2
3263
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, shift+tab , 44 dropdown menu opens OK. How to fix ? How to use VCSE 2008 with .net framework source code to find the line in
0
9489
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10101
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.