Is there an event which fires before a user enters a row into the datagridview in .net 3.5 - vb.net

I am trying to create a wrapper to replace the sheridan datagrid actvex control with a datagridview.
The sheridan datagrid control supports an event which fires just before the user is going to add a row to the grid called BeforeInsert.
Does anyone know of an equivalent event in the datagridview control or or some other code I could write which produces the same effect?

I'm having a look at all the events here, I don't see one for Adding or Inserting a row, just Added. Although there's one for Deleting and Deleted strangely enough. I won't pretend to know why. To your question, how exactly will users be adding rows? You could try playing around with the "AllowUserToAddRowsChanged" event and change that property programatically when the user wants to add a row.

Related

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.

Custom DataGridView Cells

I need to create a custom control based on a datagrid. My need is to show the events of the day (I know there are other third-party controls).
I should redesign the cells in the datagridview but I do not know where to start, obviously do not want the code I understand that it is not a simple thing, but I would like to see one of your left indication on what to focus on.
Below is an image of what I would get

Silverlight DataGrid selection and drag-drop

I am currently implementing drag and drop using the DataGrid provided in the Silverlight SDK and I want the user to be, easily, able to drag multiple items to another list.
The grid's selection gets updated on the MouseDown event so the only way the user have to drag multiple items is to press Shift while begining the drag operation. This is not really obvious and, for me, the natural way whould have been to just click the selected block of rows and drag them. To do so, the selection needs to be updated on the MouseUp event.
I've tried to derive from the DataGrid to inject my custom DataGridRows but the DataGrid doesn't expose a way to replace the type of rows it creates.
Anyone have a solution or ideas for this?
Thank you,
Jacques.
Yes, it's unfortunate that the selection is updated on mousedown. You will need to perform some work in the mousedown event to work around this. This codeproject article should help:
http://www.codeproject.com/Tips/338594/Drag-drop-multiple-selected-rows-of-datagridview-w

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.

Informing the user that a DataGridView is being populated

I am writing a program in VB.Net to manage text messages sent through an API. It allows you to view messages in a datagridview and filter by date, sent/unsent etc...
To load the messages I'm executing an SQL statement and retrieving a DataTable which then gets set as the DataSource for my DataGridView control.
The problem is that depending on the filters selected the user could be selecting a lot of records and it would take some time for the DataSource to update. I want to inform the user of this load time by providing a progress bar or label of some kind.
I have used progress bars before when looping through data but this is loading it all at once. I thought of displaying a label when the user clicks to load the data and then hiding it when the data is loaded. But this happens instantaneously even when the data is still loading.
Is there an event on the DataGridView I can use perhaps? Something like .DataSourceLoadStart and .DataSourceLoadFinished.
I know I'm just making those events up... but hopefully it makes it clearer as to what I want.
You could set the label to be visible when load is clicked and try the: DataGridView.DataBindingComplete Event to hide it, this event gets called when the binding is complete.
MSDN Link - DataBindingComplete
A little off topic but... I wonder if you could attach a AJAX update panel with activity/loading image to a gridview? I don't think I've ever seen it done but here's a great application for it.