Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 28th, 2004, 12:04 AM
shalilatharash shalilatharash is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 13 shalilatharash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Maximum Int Field Validation from Rx Lib Field

Hi,

Really need help to debug my prob...
I'm using Borland Delphi 6...and facing problem to do field validation to check the maximum limit check on the field.
e.g : Age value must be less than 100. I've tried to use StrToInt function, but it generates this error :
[Error] frmProductsUnit.pas(394): Incompatible types: 'String' and 'TRxDBCalcEdit'


Below is my code :

if StrToInt(RxDBCalcEdit2) > 100 then
begin
MsgDlg('Bla Bla',mtError,[mbOK]);
RxDBCalcEdit2.SetFocus;
Exit;
end;

Do you know what's wrong?
Thanks in advance buddy...

Reply With Quote
  #2  
Old June 2nd, 2004, 01:38 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,691 Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 3 h 3 m 39 sec
Reputation Power: 1145
Yes, change this:
if StrToInt(RxDBCalcEdit2) > 100 then
to this:
if StrToInt(RxDBCalcEdit2.Text) > 100 then
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #3  
Old June 4th, 2004, 04:41 AM
shalilatharash shalilatharash is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 13 shalilatharash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Scorpion..

But how to do things like email validation in Delphi 6?
and also to check the Telephone No, e.g: I want the Telephone No to have "0+12+3456789" format. Is it possible?

Reply With Quote
  #4  
Old June 4th, 2004, 05:49 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,691 Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 3 h 3 m 39 sec
Reputation Power: 1145
>> But how to do things like email validation in Delphi 6
How close do you want to do email validation? Do you want to merely check if the e-mail address appears correct (e.g. Scorpions4Ever@someemailaddress.com) or do you want to actually send an e-mail to verify that it is a valid working address. For the first case, you can easily write a validation routine to check that there's an @ sign, domain name and so on.

>> I want the Telephone No to have "0+12+3456789" format.
I don't really use the Rx components, but the standard TMaskEdit component allows you to specify a mask for the edit box and you can specify one that does exactly what you want.

Reply With Quote
  #5  
Old June 6th, 2004, 11:10 PM
shalilatharash shalilatharash is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 13 shalilatharash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Scorpion...

For the Telephone No. format, actually I'm doing a project to fix the bugs of the existing system. The previous programmer uses TRxDBComboEdit for TelNo. field, and inside there already have the default Phone EditMask which is (###)###-####. I want to change it to 0+12+3456789 format, but it seems the TRxDBComboEdit component does not have EditMask properties as in TMaskEdit component, and even from the source code, I can't see anything about EditMask. I dont know where to change it to 0+12+3456789 format.

One more thing, I also have a Product Code field, using TDBEdit component, and need to do field validation for the maximum length is 6 and should be 3 characters followed by 3 numeric. In addition, its 1st character depend on the Provider field. For example, if Provider = 'Software', then the Product Code 1st character is S, and if Provider = 'Hardware', then the Product Code 1st character is H. Is this possible to do such field validation?

Thanks in advance buddy....

Reply With Quote
  #6  
Old June 7th, 2004, 12:03 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,691 Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 3 h 3 m 39 sec
Reputation Power: 1145
You can do validation in quite a few places.
1. On the TDBField.OnChange event
2. On the TDBField.OnExit event. Check the TDBField.Modified property to see if the data in it has changed or not.
3. On the dataset's BeforePost event.

Reply With Quote
  #7  
Old June 8th, 2004, 12:32 AM
shalilatharash shalilatharash is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 13 shalilatharash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The Telephone field is actually hidden at the TQuery object, I can right click on the TQuery object and go to Field Editor. Then can put the necessary Edit Mask there...hehe...

But one problem that i'm facing though, I've successfully put in the necessary Edit Mask for the Telephone field. But can we customize on the Message Dialog appear. Currently the Message Dialog that appear when user key-in an invalid value for the Telephone field is "Invalid input value. Use escape key to abandon changes.". Can we customize this?

I've tried to do it at the Telephone field OnExit event, and I put If Length(TelNo.Text)<9 then raise Exception.Create(telNoError); But I think the Length function cannot be used here, coz the EditMask already consider the field is not empty and length >0.

So, is it possible to customize the Message Dialog?


Another thing is, how to differentiate between the value and text at the combo box. Here is my code:

SQL.text = 'select civil_status, civil_status_desc from civil_status';
Open;
civil_status.Items.Clear;
civil_status.Items.Add(' ');
While Not EOF Do
begin
civil_status.Items.Add(Fields[0].AsString);
Next;
end;
Close;

How can I make the combobox value to Fields[0], and the combobox text to Fields[1]?

Thanks in advance...

Reply With Quote
  #8  
Old June 22nd, 2004, 11:30 AM
Elbryan Elbryan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Behind you
Posts: 19 Elbryan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Elbryan
ehm

ehm..i don't understand..
the SQL rule for select is
'SELECT field FROM table WHERE conditions ORDER BY field'.
Another Hint i would say to you is to use the property FieldByName of the Table (or Query).

Sincerly I don't understand your last question.
Combobox don't have the value property!

Or..Do you want to fill the items of the combobox with the fields of the table? ..

try to explain it well 'cause I'm italian and I'm silly..:P

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Maximum Int Field Validation from Rx Lib Field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT