473,499 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

If Statement with multiple controls

jpr
Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.

Jul 14 '06 #1
2 1802
do you mean something along the lines (vb.net):

Check1.checked = Father.text.trim <string.empty orelse ...
Child2.text.trim <string.empty
Check2.checked = not Check1.checked

-tom

jpr ha scritto:
Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.
Jul 14 '06 #2
On 14 Jul 2006 00:45:08 -0700, "jpr" <jp***@tin.itwrote:
>Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.
Me.Check1 = Len(Trim(Me.Father) & Trim(Me.Mother) & Trim(Me.Child1) &
Trim(Me.Child2))>0

Me.Check2 = Not Me.Check1
Wayne Gillespie
Gosford NSW Australia
Jul 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

94
13765
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it...
7
11414
by: mark | last post by:
Access 2000: I creating a report that has a record source built by the user who selects the WHERE values. An example is: SELECT * FROM CHARGELOG WHERE STDATE Between #10/27/2003# And...
3
2772
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
1
1904
by: Novice | last post by:
Hey all, I have finally managed to create a Custom WebControl and am using a technique from another programmer to maintain state between pages - I would just like to validate this idea. ...
3
2766
by: Nathan Sokalski | last post by:
When I view any page in my application a second time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize) +313...
4
5168
by: doodle | last post by:
access 97 can someone tell me the syntax for a with stement for multiple controls? pseudo (doesn't work) With cmbBox1,cmbBox2,cmbBox3 .Visible = False End With
0
1171
by: KR | last post by:
I finally got back to this. The syntax that worked for me was: For Each ctlarray As Control.ControlCollection _ In New Control.ControlCollection() _ { Form1.Controls _ ,...
1
1927
by: Froefel | last post by:
I'm trying to populate a gridview control based on a user's search criteria, but what seemed like a trivial task turns out to be a nighmare for this newbie... maybe someone can help. Here's the...
4
2375
by: AKdlm | last post by:
I am using Access 97 (I know) and am creating a lost and found database for materials in our company. I have it all set up so an employee can enter a sales order and pick a specific line/multiple...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.