473,787 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When I set the SelectedIndex Value the value is not showing up in the Combobox

Hi All,

I have a combobox with style as DropDown List.

When I set the combobox.select edIndex = 0, the first value is not showing up
in the combobox and it is simply blank.

Only if I manually pull down the list and pick the value it is showing up.

How can I programatically set the combox value and to show up the selected
value?

Any suggestions Please?

Thanks
Anand Ganesh
Nov 16 '05 #1
2 2274
Anand <an**********@h otmail.com> wrote:
I have a combobox with style as DropDown List.

When I set the combobox.select edIndex = 0, the first value is not showing up
in the combobox and it is simply blank.

Only if I manually pull down the list and pick the value it is showing up.


Works fine here: setting SelectedIndex to 0 causes the first item to show.

Could you post a short, complete program which demonstrates the problem
(perhaps creating a new demonstration project and posting the contents of
the main form's source file)?
Nov 16 '05 #2
Hi Thanks for the help.

For some reason the event was not triggered. Then somehow I used a different
logic and it helped.

Thanks Again
Anand Ganesh
"C# Learner" <cs****@learner .here> wrote in message
news:19******** *******@csharp. learner...
Anand <an**********@h otmail.com> wrote:
I have a combobox with style as DropDown List.

When I set the combobox.select edIndex = 0, the first value is not showing
up
in the combobox and it is simply blank.

Only if I manually pull down the list and pick the value it is showing
up.


Works fine here: setting SelectedIndex to 0 causes the first item to show.

Could you post a short, complete program which demonstrates the problem
(perhaps creating a new demonstration project and posting the contents of
the main form's source file)?

Nov 16 '05 #3

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

Similar topics

3
16239
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; comboBox.SelectedIndex = -1; ... }
2
7374
by: hodari | last post by:
The compiler complains that zero is not acceptable value for selectedIndex. What I am doing is loading up the combo box with the data from a dataset and then setting the SelectedIndex value to zero thus forcing the first record to be selected. This is an untyped data set and unbound... Here is a snippet: private void frmCustomer_Load(object sender, EventArgs e)
2
2235
by: Vern | last post by:
I have a combobox called sPropertyCountyCd whose datasource is a dataview. The first time I set the filter to the dataview, attach the combobox to the dataview, and set the selected index to -1 is comes up correctly as blank. However, if I change the filter, and set the selected index to -1, is always shows the first record from the dataview and changes the index to 0. I even tried to set the datasource to null, and then reassigning the...
12
4718
by: Dica | last post by:
i can't seem to find a way to cast the value in my comboBox to integer. i've tried the following: short iProjectID = Convert.ToInt16(cboProjects.SelectedValue); i keep getting a "Sepcified cast is not allowed" error. how can i do this?
1
2414
by: mike | last post by:
Hi, I'd like advice from a .NETer. I have a loadcombo routine which sets the selectedindex to -1 if it's an "add record", but then it goes to a security routine which, based on permissions sets the visible property. When the visible property is set.. 'Petition Type lblPetitionType.Visible = False
3
2178
by: Steven Thomas | last post by:
I have a combobox where I populate the remaining items on the screen according to what is picked in the combobox(dependent prompting). Is there anyway to tell when a user looses focus on the combo versus selected index changed? So, say the user clicks on the combobox and types a letter to go to the values starting with "S" the page loads, then they open the combo and pick the value they want and the page loads a gain. I only want to...
5
16501
by: Andrus | last post by:
To reproduce, run the code. Observed: System.ArgumentOutOfRangeException was unhandled Message="InvalidArgument=Value of '0' is not valid for 'SelectedIndex'.\r\nParameter name: SelectedIndex" t2.c1 contains legal value. Why this error occurs ? How to fix ?
4
1273
by: AR123 | last post by:
Hi I have created a form and need a bit of help with my javascript? My for is created using HTML and its using media surface. The form is set up to submit to an email. the problem is I have a drop down for GBP or percentage and then a box to type in the amount. When the results display in the email the are showing on a seperate line but I want this to appear together like GBP 5.00 or Percentage 9 Here is what ive got: Form field <TR>...
2
2449
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the databases in that server. Then after the user selects a database, I have another button that he/she click and I want to retrieve file groups from a specific table. At this point when he/she clicks on that button I get an error:
0
9497
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
10363
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...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.