Click here to Skip to main content
15,911,531 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionEvent: Treeview-AfterSelect Pin
watagal1-Oct-05 8:00
watagal1-Oct-05 8:00 
AnswerRe: Event: Treeview-AfterSelect Pin
watagal1-Oct-05 9:06
watagal1-Oct-05 9:06 
AnswerRe: Event: Treeview-AfterSelect Pin
Dave Kreskowiak1-Oct-05 13:48
mveDave Kreskowiak1-Oct-05 13:48 
Questionvb key lock Pin
ankur6111-Oct-05 7:52
ankur6111-Oct-05 7:52 
AnswerRe: vb key lock Pin
Dave Kreskowiak1-Oct-05 13:45
mveDave Kreskowiak1-Oct-05 13:45 
GeneralRe: vb key lock Pin
ankur6111-Oct-05 20:32
ankur6111-Oct-05 20:32 
GeneralRe: vb key lock Pin
Dave Kreskowiak2-Oct-05 2:05
mveDave Kreskowiak2-Oct-05 2:05 
QuestionHelp needed with BeginInvoke Pin
grambowk1-Oct-05 2:50
grambowk1-Oct-05 2:50 
I need some help on how to correctly use BeginInvoke.

Here's the scenario:

I have a panel on my form called Panel1 and I have a button that I use to execute a query that can have multiple resultsets.

I'm executing the query asynhcronously and then I dynamically add x number of datagrids to Panel1, where x is the number of resultsets returned by the query.

At the point at which I add the datagrid to panel1 the code stops executing and nothing gets added to Panel1.

I've looked at using the Control.BeginInvoke method but ended up making more of a mess of things. Dead | X|

Hope someone can help.

Thanks in advance.

The code looks something like this:

<br />
<br />
   <br />
<br />
Public Delegate Sub MakeGrids(ByVal ResultsTable As DataTable)<br />
<br />
Private Sub ExecuteThreadedQuery()<br />
<br />
'do various things and fill a dataset with the query results<br />
<br />
        'loop through each table in dataset<br />
        For Each table as datatable in dataset.tables<br />
<br />
<br />
                Dim NewGrid As New MakeGrids(AddressOf AddResultsGrid)<br />
<br />
                'call the AddResultsGrid sub using BeginInvoke<br />
                NewGrid.BeginInvoke(ResultsTable, Nothing, Nothing)<br />
<br />
<br />
        Next  <br />
<br />
<br />
End Sub<br />
<br />
<br />
Private Sub AddResultsGrid(ByVal ResultsTable As DataTable)<br />
<br />
        Dim ResultsGrid as DataGrid<br />
<br />
        'assign relevant properties to the grid and bind it to the ResultsTable which has been fed through<br />
<br />
<br />
        'Add it to the panel<br />
        Panel1.Controls.Add(ResultsGrid)  '***AT THIS POINT THE CODE STOPS EXECUTING AND NOTHING IS ADDED TO THE PANEL<br />
<br />
<br />
   <br />
End Sub<br />
<br />
<br />

QuestionForms in VB.NET Pin
Arfan Qadir30-Sep-05 19:09
Arfan Qadir30-Sep-05 19:09 
AnswerRe: Forms in VB.NET Pin
Gopi.V30-Sep-05 22:43
Gopi.V30-Sep-05 22:43 
GeneralRe: Forms in VB.NET Pin
alongi3-Oct-05 5:36
alongi3-Oct-05 5:36 
QuestionHow can i get the value of Mathematical Function at any point? Pin
Arfan Qadir30-Sep-05 19:04
Arfan Qadir30-Sep-05 19:04 
AnswerRe: How can i get the value of Mathematical Function at any point? Pin
Dave Kreskowiak1-Oct-05 3:11
mveDave Kreskowiak1-Oct-05 3:11 
QuestionReceive FAX Pin
Tad McClellan30-Sep-05 14:49
professionalTad McClellan30-Sep-05 14:49 
QuestionKey event question Pin
KaptinKrunch30-Sep-05 10:42
KaptinKrunch30-Sep-05 10:42 
AnswerRe: Key event question Pin
Richard_Wolf30-Sep-05 11:32
Richard_Wolf30-Sep-05 11:32 
QuestionExporting a Datagrid to Excel Pin
raysot77730-Sep-05 9:15
raysot77730-Sep-05 9:15 
AnswerRe: Exporting a Datagrid to Excel Pin
Dave Kreskowiak30-Sep-05 9:27
mveDave Kreskowiak30-Sep-05 9:27 
GeneralRe: Exporting a Datagrid to Excel Pin
raysot77730-Sep-05 10:05
raysot77730-Sep-05 10:05 
GeneralRe: Exporting a Datagrid to Excel Pin
Dave Kreskowiak1-Oct-05 3:04
mveDave Kreskowiak1-Oct-05 3:04 
GeneralRe: Exporting a Datagrid to Excel Pin
raysot7771-Oct-05 9:38
raysot7771-Oct-05 9:38 
QuestionRefreshing Reports in Crystal Reports 9 Pin
shoaibnawaz30-Sep-05 8:53
shoaibnawaz30-Sep-05 8:53 
QuestionHow do you calc the absolute location of a control? Pin
watagal30-Sep-05 8:06
watagal30-Sep-05 8:06 
AnswerRe: How do you calc the absolute location of a control? Pin
rwestgraham30-Sep-05 9:28
rwestgraham30-Sep-05 9:28 
QuestionRe: How do you calc the absolute location of a control? Pin
watagal30-Sep-05 13:39
watagal30-Sep-05 13:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.