From: Alain Dekker on
Hi,

Using VB2003.NET.

I've got a TabControl with 3 tabs. On one tab is some status information and
on the other two tabs, some data related to settings.

I've got a timer and whenever it ticks, I see how long it has been since a
certain automatic action has occured (trying to connect to a device across
the network). When its been 20s since the last connection attempt was made,
I click a button which does the connection attempt. The button is on the 2nd
tab.

The problem I have is that if I viewing the 2nd tab, then when I call
"btnMyCutton.PerformClick()" it actually does the action, and tries to
connect. But, if I'm viewing the 1st or 3rd tabs, the click does not occur.

Whats going on here? Is this some weird property of the TabControl I have to
set or a limitation of the TabControl or a bug in VS2003.NET?

If I cannot get round this behaviour, what should I use other than a tab
control to put data and settings on different tabs?

Thanks,
Alain


From: Family Tree Mike on
On 2/28/2010 12:11 PM, Alain Dekker wrote:
> Hi,
>
> Using VB2003.NET.
>
> I've got a TabControl with 3 tabs. On one tab is some status information and
> on the other two tabs, some data related to settings.
>
> I've got a timer and whenever it ticks, I see how long it has been since a
> certain automatic action has occured (trying to connect to a device across
> the network). When its been 20s since the last connection attempt was made,
> I click a button which does the connection attempt. The button is on the 2nd
> tab.
>
> The problem I have is that if I viewing the 2nd tab, then when I call
> "btnMyCutton.PerformClick()" it actually does the action, and tries to
> connect. But, if I'm viewing the 1st or 3rd tabs, the click does not occur.
>
> Whats going on here? Is this some weird property of the TabControl I have to
> set or a limitation of the TabControl or a bug in VS2003.NET?
>
> If I cannot get round this behaviour, what should I use other than a tab
> control to put data and settings on different tabs?
>
> Thanks,
> Alain
>
>

Can you move the real work code out of the click event handler method,
so it is callable in it's own right? Clicking a button in code that is
not visible, would be ill-defined at best...

--
Mike
From: Armin Zingler on
Am 28.02.2010 18:11, schrieb Alain Dekker:
> Hi,
>
> Using VB2003.NET.
>
> I've got a TabControl with 3 tabs. On one tab is some status information and
> on the other two tabs, some data related to settings.
>
> I've got a timer and whenever it ticks, I see how long it has been since a
> certain automatic action has occured (trying to connect to a device across
> the network). When its been 20s since the last connection attempt was made,
> I click a button which does the connection attempt. The button is on the 2nd
> tab.
>
> The problem I have is that if I viewing the 2nd tab, then when I call
> "btnMyCutton.PerformClick()" it actually does the action, and tries to
> connect. But, if I'm viewing the 1st or 3rd tabs, the click does not occur.
>
> Whats going on here? Is this some weird property of the TabControl I have to
> set or a limitation of the TabControl or a bug in VS2003.NET?
>
> If I cannot get round this behaviour, what should I use other than a tab
> control to put data and settings on different tabs?

Replace "btnMyCutton.PerformClick" by a call to the same procedure called
from the button's click event handler:

DoIt

sub button_click() handles button.click

DoIt

end sub

sub DoIt
Msgbox "done it"
end sub

--
Armin
From: Alain Dekker on
Thanks, thats exactly right! In the button click event I now call a private
sub-routine. Instead of telling the button to generate a click event, I now
call the private sub-routine instead.

Works perfectly...

Thanks Mike :o)

"Family Tree Mike" <FamilyTreeMike(a)ThisOldHouse.com> wrote in message
news:%239yIeoJuKHA.4636(a)TK2MSFTNGP06.phx.gbl...
> On 2/28/2010 12:11 PM, Alain Dekker wrote:
>> Hi,
>>
>> Using VB2003.NET.
>>
>> I've got a TabControl with 3 tabs. On one tab is some status information
>> and
>> on the other two tabs, some data related to settings.
>>
>> I've got a timer and whenever it ticks, I see how long it has been since
>> a
>> certain automatic action has occured (trying to connect to a device
>> across
>> the network). When its been 20s since the last connection attempt was
>> made,
>> I click a button which does the connection attempt. The button is on the
>> 2nd
>> tab.
>>
>> The problem I have is that if I viewing the 2nd tab, then when I call
>> "btnMyCutton.PerformClick()" it actually does the action, and tries to
>> connect. But, if I'm viewing the 1st or 3rd tabs, the click does not
>> occur.
>>
>> Whats going on here? Is this some weird property of the TabControl I have
>> to
>> set or a limitation of the TabControl or a bug in VS2003.NET?
>>
>> If I cannot get round this behaviour, what should I use other than a tab
>> control to put data and settings on different tabs?
>>
>> Thanks,
>> Alain
>>
>>
>
> Can you move the real work code out of the click event handler method, so
> it is callable in it's own right? Clicking a button in code that is not
> visible, would be ill-defined at best...
>
> --
> Mike


From: Alain Dekker on
Thanks Armin! I was reading the MSDN documentation on the OnClick event in
..NET and a small bell rang in the back of my head when they kept talking
about mouse clicks...and of course if the button is not visible or disabled,
the mouse click event will be swallowed.

I made the changes as you suggested and its exactly what I needed.

Thanks again,
Alain


"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:ecUadqJuKHA.2072(a)TK2MSFTNGP02.phx.gbl...
> Am 28.02.2010 18:11, schrieb Alain Dekker:
>> Hi,
>>
>> Using VB2003.NET.
>>
>> I've got a TabControl with 3 tabs. On one tab is some status information
>> and
>> on the other two tabs, some data related to settings.
>>
>> I've got a timer and whenever it ticks, I see how long it has been since
>> a
>> certain automatic action has occured (trying to connect to a device
>> across
>> the network). When its been 20s since the last connection attempt was
>> made,
>> I click a button which does the connection attempt. The button is on the
>> 2nd
>> tab.
>>
>> The problem I have is that if I viewing the 2nd tab, then when I call
>> "btnMyCutton.PerformClick()" it actually does the action, and tries to
>> connect. But, if I'm viewing the 1st or 3rd tabs, the click does not
>> occur.
>>
>> Whats going on here? Is this some weird property of the TabControl I have
>> to
>> set or a limitation of the TabControl or a bug in VS2003.NET?
>>
>> If I cannot get round this behaviour, what should I use other than a tab
>> control to put data and settings on different tabs?
>
> Replace "btnMyCutton.PerformClick" by a call to the same procedure called
> from the button's click event handler:
>
> DoIt
>
> sub button_click() handles button.click
>
> DoIt
>
> end sub
>
> sub DoIt
> Msgbox "done it"
> end sub
>
> --
> Armin