Click here to Skip to main content
15,898,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionAdding a new row to DataSource [modified] Pin
Floodlight17-Mar-10 14:05
Floodlight17-Mar-10 14:05 
AnswerRe: Adding a new row to DataSource Pin
Anubhava Dimri17-Mar-10 18:42
Anubhava Dimri17-Mar-10 18:42 
GeneralRe: Adding a new row to DataSource Pin
Floodlight17-Mar-10 19:06
Floodlight17-Mar-10 19:06 
GeneralRe: Adding a new row to DataSource Pin
Anubhava Dimri17-Mar-10 19:38
Anubhava Dimri17-Mar-10 19:38 
AnswerRe: Adding a new row to DataSource Pin
Dave Kreskowiak18-Mar-10 3:49
mveDave Kreskowiak18-Mar-10 3:49 
GeneralRe: Adding a new row to DataSource Pin
Floodlight18-Mar-10 12:40
Floodlight18-Mar-10 12:40 
QuestionMultiThreading in TabPages! Pin
dotnetme217-Mar-10 9:16
dotnetme217-Mar-10 9:16 
Answerpartial answer Pin
Luc Pattyn17-Mar-10 9:51
sitebuilderLuc Pattyn17-Mar-10 9:51 
I haven't looked at all that code, here are a few answers and comments:

1.
If TabControl1.TabPages(TabControl1.SelectedIndex).Controls("txtMaxAddr").InvokeRequired Then 

your intentions are good, you are aware you can't just touch Controls from any thread other than the one that created them; but what about TabControl1.SelectedIndex and TabControl1.TabPages? Those parts of the statement are also touching Controls. That is were your problem is coming from.

The solution is rather easy: I assume the TabControl, its TabPages, and all their Controls all were generated by the same thread, hopefully the main thread (a.k.a. GUI thread). If so, it does not really care which of all those you use to check InvokeRequired on, so just do:
If TabControl1.InvokeRequired Then 


2.
it may be simpler to encapsulate the calculations you want performed "on a tab" as you called it, inside their own class; a little class that holds its job parameters, holds some events, creates its Thread or BackgroundWorker, and launches them. Then create handlers for the tab, and wire them to the job class's events so it knows how to return results.

Doing it that way, the job classes don't have to know about TabControls and TabPages; they do the work without being aware of the GUI, all they know is initial parameters and a way to report back.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.

GeneralRe: partial answer Pin
dotnetme217-Mar-10 10:30
dotnetme217-Mar-10 10:30 
QuestionUser Control Array [modified] ---- Solved Pin
Ibsy17-Mar-10 4:26
professionalIbsy17-Mar-10 4:26 
AnswerRe: User Control Array Pin
Dave Kreskowiak17-Mar-10 4:57
mveDave Kreskowiak17-Mar-10 4:57 
GeneralRe: User Control Array Pin
Ibsy17-Mar-10 13:47
professionalIbsy17-Mar-10 13:47 
GeneralRe: User Control Array Pin
Dave Kreskowiak17-Mar-10 14:39
mveDave Kreskowiak17-Mar-10 14:39 
Questiondecimal value in .sdf database Pin
ejaz_pk17-Mar-10 4:12
ejaz_pk17-Mar-10 4:12 
AnswerRe: decimal value in .sdf database Pin
Luc Pattyn17-Mar-10 4:18
sitebuilderLuc Pattyn17-Mar-10 4:18 
AnswerRe: decimal value in .sdf database Pin
Dave Kreskowiak17-Mar-10 4:23
mveDave Kreskowiak17-Mar-10 4:23 
AnswerRe: decimal value in .sdf database Pin
Dalek Dave17-Mar-10 4:25
professionalDalek Dave17-Mar-10 4:25 
AnswerRe: decimal value in .sdf database Pin
εїзεїзεїз17-Mar-10 6:25
εїзεїзεїз17-Mar-10 6:25 
GeneralRe: decimal value in .sdf database Pin
ejaz_pk18-Mar-10 19:40
ejaz_pk18-Mar-10 19:40 
Questiondelimitted files Pin
Daniel Engelkes16-Mar-10 17:46
Daniel Engelkes16-Mar-10 17:46 
AnswerRe: delimitted files Pin
_Damian S_16-Mar-10 18:00
professional_Damian S_16-Mar-10 18:00 
AnswerRe: delimitted files Pin
Andy_L_J16-Mar-10 19:04
Andy_L_J16-Mar-10 19:04 
GeneralRe: delimitted files Pin
Daniel Engelkes18-Mar-10 3:39
Daniel Engelkes18-Mar-10 3:39 
GeneralRe: delimitted files Pin
Andy_L_J18-Mar-10 8:45
Andy_L_J18-Mar-10 8:45 
GeneralRe: delimitted files Pin
Andy_L_J18-Mar-10 8:54
Andy_L_J18-Mar-10 8:54 

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.