Click here to Skip to main content
15,894,825 members
Home / Discussions / C#
   

C#

 
GeneralValidating a windows form Pin
Wjousts22-Sep-03 7:44
Wjousts22-Sep-03 7:44 
Hi,

I have a windows form which is used to config my application settings. It contains a couple of text boxes that are supposed to contain file paths to some other applications which are used by my application. What I would like to do is when the user clicks the okay button (to accept the changes they've made to the settings) I like the form to validate both text boxes to check that they are okay (a simple test to see if the files actually exist). The problem is that I've tried using the validating event on the text boxes but that gets fired when the textbox losses focus (which I don't want), but doesn't get fired when I click the okay button (which I want to have happen). I tried using the validate event on the form itself, but that never seems to get fired. What's the right way to do this? I know I can just validate the boxes in the OnClick event of the okay button, but I'll probably be adding more controls to the form and I don't want to lump all the validation in one place when it seems to make more sense to have the controls deal with their own validation.

Cheers
Generalcall unmanaged ActiveX method from C# Pin
rishikt22-Sep-03 6:16
rishikt22-Sep-03 6:16 
GeneralAccessing datasets on form Pin
phimix22-Sep-03 6:10
phimix22-Sep-03 6:10 
GeneralRe: Accessing datasets on form Pin
Mike Osbahr22-Sep-03 7:26
Mike Osbahr22-Sep-03 7:26 
GeneralRe: Accessing datasets on form Pin
phimix22-Sep-03 19:26
phimix22-Sep-03 19:26 
GeneralMultithreaded Apps Pin
Ricardo Moncada22-Sep-03 6:04
Ricardo Moncada22-Sep-03 6:04 
GeneralRe: Multithreaded Apps Pin
scadaguy22-Sep-03 8:11
scadaguy22-Sep-03 8:11 
GeneralRe: Multithreaded Apps Pin
Ricardo Moncada22-Sep-03 10:27
Ricardo Moncada22-Sep-03 10:27 
GeneralFreeze form when it removing and reloading ctls Pin
Chris#22-Sep-03 5:57
Chris#22-Sep-03 5:57 
GeneralRe: Freeze form when it removing and reloading ctls Pin
Julian Bucknall [MSFT]22-Sep-03 7:03
Julian Bucknall [MSFT]22-Sep-03 7:03 
GeneralMS Word programming in C#. Pin
bimpy22-Sep-03 5:25
bimpy22-Sep-03 5:25 
GeneralC# switch case style Pin
Don Kackman22-Sep-03 5:24
Don Kackman22-Sep-03 5:24 
GeneralRe: C# switch case style Pin
Julian Bucknall [MSFT]22-Sep-03 7:14
Julian Bucknall [MSFT]22-Sep-03 7:14 
GeneralRe: C# switch case style Pin
Don Kackman22-Sep-03 8:39
Don Kackman22-Sep-03 8:39 
GeneralRe: C# switch case style Pin
Julian Bucknall [MSFT]22-Sep-03 10:05
Julian Bucknall [MSFT]22-Sep-03 10:05 
GeneralRe: C# switch case style Pin
Don Kackman22-Sep-03 10:18
Don Kackman22-Sep-03 10:18 
GeneralSmoothing as in MSVisio2002 Pin
Wizard_0122-Sep-03 3:54
Wizard_0122-Sep-03 3:54 
GeneralIE and .NET question Pin
yoaz22-Sep-03 2:34
yoaz22-Sep-03 2:34 
GeneralVisual Studion.Net 2002 closes by itself any time I try loading a C# project Pin
okoji Cyril22-Sep-03 1:20
okoji Cyril22-Sep-03 1:20 
GeneralRe: Visual Studion.Net 2002 closes by itself any time I try loading a C# project Pin
Braulio Dez22-Sep-03 5:06
Braulio Dez22-Sep-03 5:06 
GeneralRe: Visual Studion.Net 2002 closes by itself any time I try loading a C# project Pin
okoji Cyril23-Sep-03 2:02
okoji Cyril23-Sep-03 2:02 
GeneralBooks in C# Pin
nevhile.net22-Sep-03 1:02
nevhile.net22-Sep-03 1:02 
GeneralRe: Books in C# Pin
Azel Low22-Sep-03 3:12
Azel Low22-Sep-03 3:12 
GeneralRe: Books in C# Pin
Braulio Dez22-Sep-03 5:07
Braulio Dez22-Sep-03 5:07 
GeneralRe: Books in C# Pin
phimix22-Sep-03 6:10
phimix22-Sep-03 6:10 

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.