🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #46

Tabcontrol problem

#46
From: 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
Technical Details
Message-ID: <45c9f76f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,89bb95cefc2ed33d,start
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 07 Feb 2007 16:59:41 +0100
From: Brigitte Spatz <brigitteNOSPAM.spatz@svenmahn.de>
Organization: Sven Mahn IT-Systementwicklungen
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.winforms.controls.using
Subject: Tabcontrol problem
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 000710-3, 05/02/2007), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 89.54.115.156
Message-ID: <45c9f76f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170863983 89.54.115.156 (7 Feb 2007 07:59:43 -0800)
Lines: 41
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail