Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

ComboBox woes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wade - 27 Sep 2004 21:39 GMT
I need help solving a couple of problems (and learning a couple of concepts)
involving ComboBox columns in my DataGrid.

The first problem involves my custom ComboBoxColumn class. I don't have
experience making custom classes so I downloaded some code.  From what I've
read, it's pretty standard for adding a ComboBox column.  It overrides the
Edit, SetColumnValueAtRow, and GetColumnValueAtRow subroutines.

It works great, but it doesn't allow the user to type in custom items in the
combobox. Anything you type in just gets ignored. I want users to be able to
add new items to the database through the comboboxes. I don't understand all
of this code, though, so I'm not sure how to do this. The comboboxes are
bound to datatables, so when the changes are committed I just need to add a
new row with the new text to the datatable. Then when my "Update Database"
button is clicked, the table changes will get sent to the database. It looks
like maybe SetColumnValueatRow is the key subroutine?

The second problem involves the relationship between my query form and my
display form. My query form is a series of ListBoxes bound to certain
DataTables in my DataSet. But before I fill the tables from the database, I
add an item called "All" to the tables so that I can select all items in the
listbox for query purposes. The problem is that the comboboxes in my datagrid
are bound to the same tables, so I have to remove the "All" item before
displaying the datagrid or else "All" will be displayed as a selectable item
in the combobox. This works fine if you use the query form once, but if the
user clicks the "Back" button on the display form I have to put the "All"
item back into the tables for use in the query form. But inserting an item in
a datatable that is already filled doesn't seem to be as trivial as adding a
row to a blank table. Obviously I want "All" to be the first item in the
list, so I can't just tack it on to the end. Right now I have to clear the
tables and refill them, which is taking about 15 seconds. I guess one
solution is to just make copies of the tables and put "All" at the first
index in one of them and bind each listbox and combobox to different tables,
but it seems there should be a more elegant solution. Is there a syntax for
inserting a custom item in a datatable at index 0?
Wade - 27 Sep 2004 22:07 GMT
I forgot to add I'm using Visual Basic .NET

> I need help solving a couple of problems (and learning a couple of concepts)
> involving ComboBox columns in my DataGrid.
[quoted text clipped - 31 lines]
> but it seems there should be a more elegant solution. Is there a syntax for
> inserting a custom item in a datatable at index 0?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.