Visual Basic Development Bookmark and Share   
 Home > Visual Basic IDE > The DataGrid
 

The DataGrid

I am using Visual Basic.Net 2003 with an Access 2000 database.

An integral part of the program that i'm working on is a DataGrid which I am filling from three different queries, based on the user's input. The Grid properties are coded with specific requirements for each of the queries. I have two simple (hopefully) problems.

1) There is no scroll bar on the grid and I can't find a property or event that will allow me to add the Vertical Scroll Bar. How do I do that.

2) The grids contain only four columns each. I want the user to be able to click on a cell and populate four string variables.

Has anyone any suggestions?
sirMilt  Wednesday, November 11, 2009 11:27 PM
Two suggestions:
1. The scroll bar will be shown automatically, if there is no Vertical Scroll Bar, maybe there is no enough data records to force the scroll bar to appear.
Or, please try this lines to see whether it can do the trick.
        For Each ctrl As Control In dg.Controls
            If TypeOf ctrl Is HScrollBar Then
                CType(ctrl, HScrollBar).Enabled = True
            ElseIf TypeOf ctrl Is VScrollBar Then
                CType(ctrl, VScrollBar).Enabled = True
            End If
        Next
2. There is no cellclick event in datagrid, so why not use visual basic 2008 express? If you use datagridview, then, it's simple to achieve your goal.

http://www.microsoft.com/express/vb/Default.aspx





MaDFroG20091013  Monday, November 16, 2009 6:14 AM
Two suggestions:
1. The scroll bar will be shown automatically, if there is no Vertical Scroll Bar, maybe there is no enough data records to force the scroll bar to appear.
Or, please try this lines to see whether it can do the trick.
        For Each ctrl As Control In dg.Controls
            If TypeOf ctrl Is HScrollBar Then
                CType(ctrl, HScrollBar).Enabled = True
            ElseIf TypeOf ctrl Is VScrollBar Then
                CType(ctrl, VScrollBar).Enabled = True
            End If
        Next
2. There is no cellclick event in datagrid, so why not use visual basic 2008 express? If you use datagridview, then, it's simple to achieve your goal.

http://www.microsoft.com/express/vb/Default.aspx





MaDFroG20091013  Monday, November 16, 2009 6:14 AM
To get to properties of a Grid I click on the page that holds the grid. Then I display the properties of that page. I then click inside the grid which will display the proerties of the grid itself. Within the properties of the grid there is an option for scroll bars. (zero, one, two) Click on 2. I hope this helps.
Canadian Moses  Monday, November 16, 2009 12:10 PM
Thank you both for trying to help. Unfortunately I was not able to try your suggestion until today as I had a physical problem and ended up in the hospital. I'm back now and tried out both suggestions.

MadFroG20091013
I tried your code in both the DataGrid Enter event and in my own Sub routine that calls the DataGrid. In both cases I end up with A verticalgray column on the right side of the grid but no vertical scroll bar.

The DataGridView in Express works perfectly but I can't use it because there are several crystal Reports in the system that I am working on andas I Understabd it, the "Click Once" won't work and the "Publish" option is not in Express. Since I'm actually retired I don't want to go to the expense of buying the Professional version, particularly sinceI won't be using C++ or C # and i can't find any place where I can buy only Visual Basic.

Canadian Moses
Unfortunately there is no ScrollBars option in the properties for the DataGrid in Visual Basic.NET 2003 as there is in the DataGridView inVisual Basic.Net 2008.

Thank you both for trying to help
Milt
sirMilt  Friday, November 20, 2009 3:57 PM

You can use google to search for other answers

Custom Search

More Threads

• VS 2005 Data Source List Not Refreshing With New Properties Of Classes
• How to make a module display intellisense correctly
• Print option
• XML Documentation & Intellisense file locking issue
• oledb vs sqlclient data adapter performance when running in ide
• Is it possible to declare a UserControl as MustInherit, and then use its child classes in the Designer?
• Update dataset column datatype in bulk
• Disabling locked design view
• Debugging: Not showing updated forms
• Doesn't adjust Menuitem.Index properly in code from VB 2003