Adding several datasource on same column in DataGridView - vb.net

I'm working on VB .NET 2008.
Target: Bind dynamic datasource in a cell of a Windows.Forms.DataGridView depending on the selection in previous column. The grid must have 7 columns. If the selection on comboboxcolumn 2 or 4 is done, the datasource of comboboxcolumns 3 and 5 mus change using a query with previous selection as parameter.
In a first try to develop this functionality i've tried to use Telerik.WinControls.UI.RadGridView control. I've created a customized celltemplate with a combobox in order to have different datasource for each cell on the same column. All worked fine but seems to be some kind of bug in RadGridView, because when the combobox is presenting the list, after selection the list continued showing, doesn't dissapears as expected.
Ok, after several days of fight with RadGridView, I give up, and I tried to use same strategy but using Windows.Forms.DataGridView. I've created two classes one inherited from DataGridViewComboboxCell and other from ComboBoxColumn, in order to insert my own combbox or have the chance to have access directly to the combobox values. But the combobox showed is the default combobox not my own combobox.
Anyone knows how can I create a custom comboboxcell but using my own combo, and having access from outside to this combo?
Thanks in advance.
Regards.

You might be overwhelming the abilities of your controls. You can always break them out into parent/child or master/detail grids instead of keeping them combined into one.

Related

need assistance Ultragrid (infragistics). cant combine data columns from 2 sources

i have a project with winform and VB.net.
i got there 2 UltraGrids (infragistics) that each one has its own data source.
its working great but i need to do some changes.
how can i combine a field to the first from the other?
i have tried to change columns with the Ultragrid designer, even though i can see it, it doesn't show.
the first grid gets datasource and the other gets the data from SQL Query.
is it only by code or there is a shortcut?

vb.net datagridview and bindingsource

Im in the process over converting some legacy VB6 code over, in particular a TDBGrid linked to an ADODC data control.
Everything is going ok, ive got my columns and bindignsource reading sweet as a nut and performing what its supposed to do, correctly - but im having a problem converting this type of method over.
In the vb6 app, while a user scrolls through the grid, the grid fetchstyle (similar to cellformatting) go looking at the equivalent row of data in the adodc.
In .net, I cant seem to get that functionality to be the same, unless I add that field from the database, into a column in the grid and make it invisible (which I dont really want to be doing if i can help it) then read the cell via cellformatting and then perform some action, such as changing the cellstyle backcolor to something.
Is it possible to refer to a row in the bindingsource that would be the same row in the grid that a user is at, without having that field from the bindingsource - in a DGV column?
or do i just have to put up with placing more columns in the DGV than I want and just live with it?
Thanks!
I think you want the BindingSource.Current
object.

vb datagrid refresh after updating data in another form

I have a couple of forms, one without datagrid and one with datagrid. The one without datagrid is for adding values to the database, and that happens. When I come to the page with datagrid, the updated value does not show up. If I see the tableadapter and it has the new values but the datagrid doesn't. I have tried .refresh() which obviously just redraws and un-binded and re-binded the datasource too but that doesn't work either. Any help will be appreciated.
You should put your data into something that inherits INotifyPropertyChanged, or create some classes yourself that do this. Since this might be a little complex for you, you can simply refresh the data by clearing and applying the DataSource again.
MyGrid.DataSource = Nothing
MyGrid.DataSource = DT
You will need to replace the grid name and DataSource with your variables

Filtering DataGridView using Comboboxes

Let me preface this by saying I am a beginner as far as .net knowledge.
I am developing a windows form application using tabs in VS2012 in vb. I have bound the datagrid through the designer to a sql server binding source which is populating the data. There are multiple columns in the table and these are split between two tabs with a datagrid on each tab. Both data grids have the same binding source just show different columns.
I created a view within the SQL server to pull in the column names. I think what I want to do and not sure if this is possible but have 2 combo boxes that will be used to filter. One of the would be bound to the view by a dataadapter and then the second to the datagrid binding source.
when the user selects the first combobox(columnname) it would then pull from the datagrid for that column and pull in the valid values to filter. It would then filter the datagridview and refresh it.
Then I am trying to remove the filters through the use of a button.
Can someone please help as I don't even know where to start
You can use Dataview in filtering datasources. You can refer to my answer at this question

TableAdapter Update fail

I have a VB windows Form project that connects to several DataTables in an Access DB. On my form I have several textboxes, comboboxes and datetimepickers that are bound to those sources. With one table in particular when I try to update the tableadapter after editing one of the textboxes the update method fails. No exceptions are thrown, but the update method returns a zero value and the data is not updated. The update will work when just the comboboxes or datetimepickers are edited, but as soon as a textbox is edited also, update will not work.
Other DataTables within the project are set up in the same manner but are not having update issues. I can't figure out what about this one particular table is causing an issue. Can anyone give me any thoughts on where or what to troubleshoot?
Thanks!
try adding another textbox or other control pointed to the same source and see if you can get that one to update. Could be something funky with the control's settings that you're missing, and if you start over, it would be fine.