473,624 Members | 2,281 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 1806
do you mean something along the lines (vb.net):

Check1.checked = Father.text.tri m <string.empty orelse ...
Child2.text.tri m <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.itwr ote:
>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.Valu e = 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.Fat her) & 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
13856
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 would be more orthogonal if a method could only have one return statement. --
7
11432
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 #11/2/2003# And VehicleID='00000000' And BattID='LKO500HF'. I need to use the records returned to populate text boxes, but the data requires further manipulation. I attempting to use expressions in the control source
3
2784
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 reference these pages/ controls from my ASP.NET web projects WEbApp1 url http://localhost/app1 C:\Apps\App1
1
1911
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. Basically I have created a Custom Web Control that is capable of generating multiple webpages. It actually only creates one webpage, but hides Panels (that contain the web controls - TextBox's, Labels, etc) to give the impression that the user is...
3
2780
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 System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +201 System.Web.UI.Control.BuildProfileTree(String parentId, Boolean calcViewState) +263
4
5183
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
1179
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 _ , Form1.tabPage1.Controls _ , Form2.TabPage2.Controls _ } For Each ctl As Control _ In ctlarray
1
1933
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 (simplified) business requirement: 1. Allow the user to specify search criteria (country, action, status) 2. Display results of the search in a gridview, after the using clicks the search button. 3. Allow paging and sorting on the gridview 4....
4
2386
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 lines from that sales order to choose what has been lost. If the quantity of the Sales order line is 30, they can choose with an input box how many was lost. My problem is, if the quantity of the sales order is 30, they can still say they lost 40 -...
0
8242
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8488
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
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 we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.