Now that I can see the data in the datagrid, I realize that the size of the fields is too small - the customerid and customer name fields both could use expanding so that I can see all of the text. Is there a way to programmatically extend the length of the field so that it can show the entire string?
PrivateSub DataGridView1_DataBindingComplete(ByVal sender AsObject, ByVal e As System.Windows.Forms.DataGridViewBindingCompleteEventArgs)Handles DataGridView1.DataBindingComplete
Dim _DGV As DataGridView = DirectCast(sender, DataGridView)
You also can add a ContextMenuStrip to your solution and respond on the rightclicking of a user into one of the columns in your datagrid.
For example, if the user rightclicks into a column a menuitem will be shown with "show all data". If clicked, that particular column will be autosized.
Add the variabele _ActiveColumn to the general declaration section.
Add a contextmenu to your solution with 1 item "Show all data"
PrivateSub DataGridView1_CellMouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs)Handles DataGridView1.CellMouseDown
_ActiveColumn = e.ColumnIndex
If e.Button = Windows.Forms.MouseButtons.RightThen
Me.ContextMenuStrip1.Show(Me.DataGridView1, New Point(e.X, e.Y))
EndIf
EndSub
PrivateSub ShowAllDataToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles ShowAllDataToolStripMenuItem.Click
ForEach oCol As DataGridViewColumn In Me.DataGridView1.Columns
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.