Exception handling /Multiple form application in Builder

Hi,
I am writing a application containing one main form Form1 with few standard components on it by witch user input his data.

I am trying to make protection against wrong data inserting or its omiting.

I read out that for my problem "Exection handling" issues can occure to be very helpful.

Fallow this trace I opened new form Form2, inserted proper message on it and added it to my project.

In sorce code of Form1 I added:

1
2
3
4
5
6
7
8
9
try 
{ 
...(algorithms) 
} 

catch(...) 
{    
Form2->Enabled=true; 
}


but nothing happend.

Still the system message occure and Form2 is absent.

I don't know what is wrong.
Maybe someone will help.
Thanks in advance.
I wrote new, small application showing the same problem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <vcl.h> 
#pragma hdrstop 

#include "Unit1.h" 
#include "Unit2.h" 
#include "math.h" 
//--------------------------------------------------------------------------- 
#pragma package(smart_init) 
#pragma resource "*.dfm" 
TForm1 *Form1; 
//--------------------------------------------------------------------------- 
__fastcall TForm1::TForm1(TComponent* Owner) 
        : TForm(Owner) 
{ 

} 
//--------------------------------------------------------------------------- 


void __fastcall TForm1::RadioButton1Click(TObject *Sender) 
{ 
radio=17.0; 
} 
//--------------------------------------------------------------------------- 

void __fastcall TForm1::Button1Click(TObject *Sender) 
{ 
int x; 
double y; 
x=Edit1->Text.ToInt(); 
bool checked; 
checked=CheckBox1->Checked; 

if(checked==true) 
{ 

        try 
        { 
                y=x*log10(radio); 
                Edit2->Text=AnsiString(y); 
        } 
        catch(...) 
        { 
                Form2->Show(); 
        } 
} 
} 
//--------------------------------------------------------------------------- 


Form1 consist of two Edit, Button, RadioButton and Checkbox.

The problem is that I don't know how to make the Form2 to appear insted of fallowing message:

log10: SING error

in situation when user forgetten to click Radiobutton.
Topic archived. No new replies allowed.