Link to home
Start Free TrialLog in
Avatar of rfgraham
rfgrahamFlag for United States of America

asked on

Text not visible in DataGridView1 VB.Net 2005

The following code collects data from a SQL DB and populates a DataGridView, the only problem is I can't see the data in the DataGridView. If I select a cell then I can see whats in that cell., but I need to see all of the records in the DataGridView rows. The color of the text is white so it's no wonder I can't see it. I have tried to find in the properties of the DataGridView how to fix this problem back I haven't had any luck. There has got to be a way of selecting the text color.

Any help would be appreciated.


Dim MySQLConnection As String = My.Settings.dbConnection
        Dim dbConnection As New SqlConnection
        dbConnection.ConnectionString = MySQLConnection

        Dim bsPatients As BindingSource
        bsPatients = New BindingSource
        dbConnection.Open()
        Dim strSQL As String = "SELECT FirstName, LastName, Address FROM Patient WHERE LastName = '" & LastName.Text & "' ORDER BY FirstName"

        Dim myDA As SqlDataAdapter = New SqlDataAdapter(strSQL, dbConnection)

        'Dim myPatient As DataSet = New DataSet()
        Dim myPatient As DataTable = New DataTable
        myDA.Fill(myPatient)

        bsPatients.DataSource = myPatient
        DataGridView1.DataSource = bsPatients
        dbConnection.Close()
        dbConnection = Nothing

    End Sub
ASKER CERTIFIED SOLUTION
Avatar of SameerJagdale
SameerJagdale
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rfgraham

ASKER

So, there is no way to select text color in the properties of the DataGridView object? I can select foreground, background color but not text color? You wouldn't happen to know why Microsoft developed this object like this would you?