🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.winforms.controls.using
2 messages
2 total messages Started by Brigitte Spatz Wed, 07 Feb 2007 15:59
Tabcontrol problem
#46
Author: Brigitte Spatz
Date: Wed, 07 Feb 2007 15:59
41 lines
2996 bytes
Using BDS2005:

I have a tabcontrol that I had originally designed with three tabs. Now 
we don't always need the three, so I removed the third one and only add 
it at runtime as and when needed. However, since removing the third tab 
I keep running into weird problems whenever I'm working with only two tabs:

Tabsheet1 contains a readonly datagrid. Tabsheet2 contains input boxes 
etc. bound to an SQL Server database table via a dataview (which is also 
the datasource for the grid on tabsheet1). Now when I add a new record, 
enter some data into the input boxes and try to switch to tabsheet1 I 
keep getting an "object reference not set" error message and the 
debugger stops at application.run. Also, when I try to save the changes 
(which afterwards involves switching to the grid) rather than switch 
tabs without saving, I get a similar error message but the debugger 
stops in
     TabControl1.SelectedIndex := 0;
even though immediately before I can display the Tabcontrol1.Tabcount 
and Tabcontrol1.SelectedIndex successfully. In the first case (i.e. 
switching tabs without saving) I can see the grid except for the last, 
new row of which there is only the indicator visible but nothing more.

On the odd occasion I've also had a problem with adding the new record: 
I can then only fill in the first three input boxes but do nothing 
afterwards, neither tab to the next field nor click any button or click 
the mouse pointer into the next field, but there's no error message either.

And just now, I've had no problems switching tabs, but that was once in 
about 100 attempts.

As I said, as soon as I have all three tabs displayed, there's no 
problem whatsoever - I can save, I can change tabs, everything's fine. 
I've put conditions of tabcount and/or selectedindex into all places 
that refer to the non-existent tabs so these parts can't interfere when 
the third tab isn't present.

What could be the cause?

TIA.

Brigitte
Re: Tabcontrol problem
#47
Author: Marc Rohloff TeamB
Date: Fri, 09 Feb 2007 02:57
15 lines
1630 bytes
On Wed, 07 Feb 2007 16:59:41 +0100, Brigitte Spatz wrote:

> I have a tabcontrol that I had originally designed with three tabs. Now 
> we don't always need the three, so I removed the third one and only add 
> it at runtime as and when needed. However, since removing the third tab 
> I keep running into weird problems whenever I'm working with only two tabs:

Can you create a simple example which illustrates the problem?

Also have you tried checking the call stack at the point you get the
exception?

-- 
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads