473,396 Members | 2,151 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.

C# Windows Form - Comboboxes and SelectedItems

I'm just learning C# for this huge project at work, so bear with me. This application takes ticket numbers from the user and displays the ticket information in the form. Simple enough. I'm having an issue though with the comboboxes.

Since I want users to be able to update the tickets (and this works, so far except on these stupid boxes), the comboboxes should display the data from the specific ticket as the selected item, but ALSO have a dropdown list of all the possible values for that combobox. For this example we'll use the "Site Name" combobox, which is combobox55 on my form.

The first part, displaying the data from the ticket, works fine. The second part, displaying a list of all possible data, does not.

In the "Combobox Tasks" window in VS2005 I have as the Datasource the "Sitename" datasource, and the display and value member boxes both are set to "site." (which I have configured and tested, selecting "Preview data" shows all the site names.) The Selected Item box has the table row that corresponds to the Site Name coming from the ticket database.

However when I type in the ticket number, the box is populated only with the Site name for that ticket, and nothing else.

I have tried the "Add query" dialog, but all it does is add a toolstrip to the top of my window? I'm not sure how that works.

Thanks,
Mike
Apr 2 '08 #1
4 1802
rjvrnjn
26
However when I type in the ticket number, the box is populated only with the Site name for that ticket, and nothing else.
Are you re-populating the data in the combo-boxes based on user input in the ticket number? If yes, how are you doing that?
Apr 2 '08 #2
Are you re-populating the data in the combo-boxes based on user input in the ticket number? If yes, how are you doing that?

I'm not re-populating really, just populating. When the form loads up, the fields are blank, but then when the user enters a ticket and clicks the button, the DB gets called and fills up the fields.

If the user searches for a second ticket, the fields all flush (apparently through some built in mechanism, because I'm not doing that) and they display the ticket.

Relevant code to fill the form in question:

this.hD__Trouble_TicketTableAdapter.FillBy_CaseID( this.dataSet2.HD__Trouble_Ticket, CaseID);

Where CaseID is the trouble ticket number.
Apr 2 '08 #3
nateraaaa
663 Expert 512MB
It sounds like you want the drop down list to include all of the Site Names possible and the site name that currently exists for the ticket number. You may want to use a proc (datasource query) to bring back the possible site names and then just add the site name that currently exist (a separate query would give you the data for a ticket number) for that ticketNumber to the dropdownlist manually.

Here is an example of how to add items manually (in the code behind) to a combobox.
http://www.msnewsgroups.net/group/mi...opic23388.aspx

Nathan
Apr 2 '08 #4
rjvrnjn
26
If I get your issue correctly, I say I would have taken a different approach. If you want to populate the site drop down only after the user has entered a trouble ticket, then get all the possible values into the site combo and set the selectedText or SelectedValue to the current ticket's site value. But if you want to build up the site combo list as the user keeps on entering the ticket number then the method suggested above is the way to go.
Apr 2 '08 #5

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

Similar topics

2
by: aaa | last post by:
Hello to all, In an application under VB6, I need to fill some ComboBoxes with data. However, I don't know in advance how many ComboBoxes I will need. I could of course create many (maybe 15 or...
1
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
1
by: Steve | last post by:
I have a form with about 30 fields. Much of data entry for this form involves the same data for many of the fields. To save typing time, in the form's AfterUpdate event I run a procedure that sets...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
2
by: Simon Jefferies | last post by:
Hello, How do I perform a drag and drop from a list view control to windows explorer? I am looking to perform a file copy from files in my list view to the destination in the windows explorer...
7
by: Progalex | last post by:
Hi everybody! I have a listview and a treeview in a form . With an OpenDialog I let the user select multiple files and then these files are added to the listview with the complete pathname,...
3
hyperpau
by: hyperpau | last post by:
Hi there guys! I have a Form where there are three comboboxes. This comboboxes are used as references for the parameter of 3 fields in a query. when I hit a command button in my form, it opens...
4
by: mashimaro | last post by:
Hi! I want to ask how can I get the record from the query. I currently have a form with 5 comboboxes and a button. After the user fills those 5 comboboxes and hit the button, a new form is opened...
23
by: Dan Tallent | last post by:
A textbox has a attribute for ReadOnly. This seems like such a simple concept. When a textbox is set to read only the user cannot change the contents of the field. I have been trying to find...
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
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
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
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.