A
Alex Cote
Guest
Hi,
trying to figure out what's wrong but just can't.
So I have a class that Inherit TabPage control to create my own custmize one. In that class I create my TabPage with all the needed controls for my program. This part works fine ... king of.
When I start my program I use that class to create my first tab, and in that tab there's a Datagridview control. Then the user can do a db search and it fill that datagridview. The user can, at that point, open one of the record into another instance of the customize TabPage, and that's where I have a problem I can't figure out.
Here's the part of the code where I have the problem I don't understand:
Private Sub DoTheSearch(Optional MySQLstr As String = Nothing)
Try
clsTabDataTable = New DataTable
If IsNothing(MySQLstr) Then
Dim frmCriteria = New SearchCriteriasForm
frmCriteria.ShowDialog()
clsMainQueryStr = MainQueryStr
clsTabDataTable = clsGetSearchResults()
Else
clsMainQueryStr = MainQueryStr
clsTabDataTable = clsGetSearchResults()
End If
If Not IsNothing(clsTabDataTable) Then
clsDgvMyResults.DataSource = clsTabDataTable
MsgBox(clsDgvMyResults.Rows.Count)
clsLoadResulatsToDgv()
clsDisplaySelection(clsTabDataTable.Rows(0))
Else
MsgBox("Aucun standard trouvé correspondant au(x) critère(s)", MsgBoxStyle.Exclamation, ProgramName)
End If
Catch ex As Exception
MsgBox(ex.Message & vbNewLine & vbNewLine & ex.StackTrace,, GetCurrentMethod().Name)
End Try
End Sub
The "clsGetSearchResults()" is a function that return a DataTable.
So on both time I create a tab I use that same sub, first shot no problem everything's fine. On the second, even though the datatable contain 71 rows and the datasource also, when I get to the line "MsgBox(clsDgvMyResults.Rows.Count)" the row count is zero, and the program really does not find any data in the datagridview.
Any idea of why it's doing that?
Regards
Continue reading...
trying to figure out what's wrong but just can't.
So I have a class that Inherit TabPage control to create my own custmize one. In that class I create my TabPage with all the needed controls for my program. This part works fine ... king of.
When I start my program I use that class to create my first tab, and in that tab there's a Datagridview control. Then the user can do a db search and it fill that datagridview. The user can, at that point, open one of the record into another instance of the customize TabPage, and that's where I have a problem I can't figure out.
Here's the part of the code where I have the problem I don't understand:
Private Sub DoTheSearch(Optional MySQLstr As String = Nothing)
Try
clsTabDataTable = New DataTable
If IsNothing(MySQLstr) Then
Dim frmCriteria = New SearchCriteriasForm
frmCriteria.ShowDialog()
clsMainQueryStr = MainQueryStr
clsTabDataTable = clsGetSearchResults()
Else
clsMainQueryStr = MainQueryStr
clsTabDataTable = clsGetSearchResults()
End If
If Not IsNothing(clsTabDataTable) Then
clsDgvMyResults.DataSource = clsTabDataTable
MsgBox(clsDgvMyResults.Rows.Count)
clsLoadResulatsToDgv()
clsDisplaySelection(clsTabDataTable.Rows(0))
Else
MsgBox("Aucun standard trouvé correspondant au(x) critère(s)", MsgBoxStyle.Exclamation, ProgramName)
End If
Catch ex As Exception
MsgBox(ex.Message & vbNewLine & vbNewLine & ex.StackTrace,, GetCurrentMethod().Name)
End Try
End Sub
The "clsGetSearchResults()" is a function that return a DataTable.
So on both time I create a tab I use that same sub, first shot no problem everything's fine. On the second, even though the datatable contain 71 rows and the datasource also, when I get to the line "MsgBox(clsDgvMyResults.Rows.Count)" the row count is zero, and the program really does not find any data in the datagridview.
Any idea of why it's doing that?
Regards
Continue reading...