473,698 Members | 2,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Windows Form - Comboboxes and SelectedItems

24 New Member
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 1807
rjvrnjn
26 New Member
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
somacore
24 New Member
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__Troubl e_TicketTableAd apter.FillBy_Ca seID(this.dataS et2.HD__Trouble _Ticket, CaseID);

Where CaseID is the trouble ticket number.
Apr 2 '08 #3
nateraaaa
663 Recognized Expert Contributor
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 New Member
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
8674
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 20) and only use those that I need. However, I would rather like to programmatically create and them to my form. How can this be achieved? Also, is there a generic method that could be used with other objects? (For example, programmatically...
1
2101
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 content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
1
2476
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 the defaultvalue property of each field to the value of that field in the last saved record. Essentially what happens is when a record is saved it becomes the default new record in the form. I have some comboboxes on the form that draw their data...
4
3170
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. Tables: (abbreviated) TblDivision DivisionID
2
6239
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 program. Thanks in advance Regards
7
10410
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, while they are added to the treeview without the path (only file name). I'd like the user would be able to remove multiple items selecting filenames from the listview. So, items should be removed both from the listview and the treeview. How can I do...
3
2698
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 a query with the parameters selected from the form. Let's say I have three fields in my query. ,, and On the design view of the query, I put these criterias on different lines so that it would be using the OR: =!!
4
1633
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 with 30 textboxes and comboboxes, I want all the 30 textboxes and comboboxes to show the value that based on the 5 values in the previous form (those 5 are primary keys in my table). My Access query return me correct record. I have tried Dlookup(),...
23
2213
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 that missing ability for other predefined controls in C#. The radiobutton, checkbox, and combobox controls do not share this ability. I find it difficult to believe that this feature was left out and Microsoft expects everyone to write...
0
8611
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
9031
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
8904
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
7741
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
6531
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
4372
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
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
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.