Good day,
I created a tabcontrol that has more than two tabpages, in each of the tabpages, i have a datagrid except the first page.
I have populated the datagrid successfully. The problem is when i click to view the 2nd tab page, the content of the datagrid will display well but on the 3rd tabpage, the content of the datagrid will not be visible (the text is white in color), that is the datagrid on the 3rd tabpage will be populated with data but the content is white in color thereby it's kinda invisible.
here is my code:
tab click event:
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If TabControl1.SelectedIndex = 5 Then
loadSymptomsCmb()
loadDiagnosisHistory(mqhModule.treatPatID)
txtDoc.Text = mqhModule.docName
ElseIf TabControl1.SelectedIndex = 6 Then
loadprescription(mqhModule.treatPatID)
loadDrugsCmb()
txtDrugsBy.Text = mqhModule.docName
End If
End Sub
code to populate datagrid:
Private Sub loadprescription(ByRef patID As String)
Try
conMod.openDB()
Dim StrSQL As New SqlDataAdapter("SELECT drugs,medicine,dura,dosage,freq,drugInstruction " & _
"presTime,presDate,prescribeby " & _
" FROM patientprescription WHERE patientID='" & patID & "' ", conMod.Con)
Dim DR As New DataSet
StrSQL.Fill(DR)
StrSQL.Dispose()
Dim usertable As DataTable = DR.Tables(0)
DGridPres.DataSource = usertable
DGridPres.Columns(0).HeaderText = "Medication"
DGridPres.Columns(1).HeaderText = "Drug"
DGridPres.Columns(2).HeaderText = "Duration"
DGridPres.Columns(3).HeaderText = "Dosage"
DGridPres.Columns(4).HeaderText = "Frquency"
DGridPres.Columns(5).HeaderText = "Instruction"
DGridPres.Columns(6).HeaderText = "Time"
DGridPres.Columns(7).HeaderText = "Date"
DGridPres.Columns(8).HeaderText = "Prescribed-By"
conMod.closeDB()
Catch ex As Exception
Dim mymsg As New myMsgbox
With mymsg
.txtError.Text = "Error! Could not retrieve Patient prescription Information."
End With
End Try
End Sub