Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have an application where I am filling certain datafields of a datatable into datagridview. Below is the relevant snippet:

VB
Dim con As New OleDb.OleDbConnection
   Dim dbProvider As String
   Dim dbSource As String
   Dim dt As New DataTable
   Dim da As OleDb.OleDbDataAdapter
   Dim sql As String

       dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"
       dbSource = "Data Source = C:\Users\30015474\Desktop\service\Service20000TM.accde"
       con.ConnectionString = dbProvider & dbSource
       con.Open()
       sql = "SELECT [RA Number], [Serial Number], [Model Number], Description, Manufacturer, Status FROM Model where Model.Status = 'O'"
       da = New OleDb.OleDbDataAdapter(sql, con)
       da.Fill(dt)
       DataGridView1.DataSource = dt.DefaultView

       con.Close()


This function executes on Form Load.

However, when I load the data, I see that the data is in the datagridview but I can only see it when I click on each individual cell (everything looks empty unless the cell is highlighted). I have been digging around but it doesn't seem like anyone else is having a similar issue.
Posted
Updated 27-Dec-13 5:58am
v2
Comments
Sergey Alexandrovich Kryukov 27-Dec-13 11:36am    
This code fragment is taken out from some context, while it's quite apparent that the problem is in this context. Think by yourself: your statement is that the context is updated when clicked, but you never show the code when the click event handler is added. Hence, you are not showing anything to see why it is not updated.
—SA
ayaraneri3 27-Dec-13 11:39am    
Sergey,

There is no click event declared in my code. Here is the entirety of my code as pertaining to this form:

Public Class Form1

Private Sub Assign_Click(sender As Object, e As EventArgs) Handles Assign.Click, Button3.Click
Calls.ShowDialog()
End Sub



Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (TextBox1.Text <> "") Then
Calls.RANumber.Text = TextBox1.Text
Calls.ShowDialog()
Else
MsgBox("Please enter a T-Number")
End If


End Sub
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds_OpenOrders As New DataSet
Dim dt As New DataTable
'Dim ds_Customers As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim tablename As String

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"
dbSource = "Data Source = C:\Users\30015474\Desktop\service\Service20000TM.accde"
con.ConnectionString = dbProvider & dbSource
con.Open()

'Load customer information'
sql = "SELECT [RA Number], [Serial Number], [Model Number], Description, Manufacturer, Status FROM Model where Model.Status = 'O'"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(dt)
DataGridView1.DataSource = dt.DefaultView

con.Close()
'End Load Customer Information
End Sub




End Class
Sergey Alexandrovich Kryukov 27-Dec-13 11:43am    
And? On what event is it updated? And what click did you mean in your title by "unless clicked"?
I did not say you declare a click event, I say that you handled it. Do you know the difference?
—SA
ayaraneri3 27-Dec-13 11:49am    
To clarify, highlighted. Below is the link of image as how I see it.

http://postimg.org/image/xmw5d9xl3/

How would I find how the click is being handled? I have not declare any handling for the click on the datagridview.
Sergey Alexandrovich Kryukov 27-Dec-13 11:57am    
Then describe what click do you mean in the title of your question...
—SA

1 solution

As noted in comments, sounds like a font issue. Something like the same color font as the background.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900