How to add event to some fields to respond to one method?


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi All,

I have a form with some fields including address fields.  There is one field FormattedAddress which I have to update with some fields concatenated for an address label.

What would be the best way to address this kind of situation?

So far I am testing in the BO_FieldPropertyChanged event, but I then have to filter this event for the list of fields that will participate in the concatenation format.  Just wondering if I am in the correct place or there is any other way to do this?

Thanks!

Edhy Rijo

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I tend to agree with Peters assessment of not storing it in the database.  I am sure that you have your reasons but creating a property to do the work for you when you need it would be more efficient and would normalize your data. 

I am sure that you already know this, but an Or in VB.NET is BitWise and an OrElse is an explicit test.  Same is true for And...you would use AndAlso in its place.  Your code will work in this scenario since this is an enum, but in other scenarios this may fail.  Another option is using a Select:

Select Case e.FieldChanged
   Case Field1, FIeld2, FIeld3, FIeld4
      '-- Add your logic here
End Select

Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Peter, Trent,

I understand what you guys are saying about using a Custom Field, and I will do it that way, but this is a learning experience for me.  I am in the process of learning and getting comfortable with VB.NET in order to move on into the .NET league Wink.

I tested it with a Select Case and it is working fine, thanks again for the push Hehe

Trent L. Taylor (03/13/2008)
I am sure that you already know this, but an Or in VB.NET is BitWise and an OrElse is an explicit test.  Same is true for And...you would use AndAlso in its place.  Your code will work in this scenario since this is an enum, but in other scenarios this may fail.  Another option is using a Select

Trent and all, I am an experienced VFP developer (20+ years), but I can not say the same for .NET and my choice language VB.NET, so please feel free to correct me, suggest, encourage and anything else necessary to help me out in this learning process at any time.

Once again, thank you both!

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Edhy Rijo - 17 Years Ago
Peter Jones - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Edhy Rijo - 17 Years Ago
Peter Jones - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Edhy Rijo - 17 Years Ago
Greg McGuffey - 17 Years Ago
Edhy Rijo - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                         Edhy,

Just offering some options. You never know when...
Greg McGuffey - 17 Years Ago
                             All good advice, Greg. I will warn you, though, that the larger your...
Trent L. Taylor - 17 Years Ago
                                 Hmmmm...good info Trent. The tables I'm using this on are small and...
Greg McGuffey - 17 Years Ago
                                     LOL....thanks, Greg! I always truly appreciate your contributions out...
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search