如果声明问题 [英] If Statement question

查看:65
本文介绍了如果声明问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常容易的人:


我有一个名为[ProjectDetailActive]的复选框

它的默认值是true


我想插入一个代码,如果同一表单上的另一个字段[ProjectDetailEndDate] = null,则无法将复选框设置为false


一边评论:

我不知道你们怎么设法找到这些代码的正确陈述。你们在哪里学习这些东西?我已经阅读过文章,书籍,访问过的网站,但是在两年内我找不到一个教授如何编写代码的地方 - 它们只给你一个代码如何读取函数的例子我永远不会使用在一百万年里,从未接近我的需要。哈利波特学校是否像秘密一样教他们如何编写代码?


我已经在互联网上数百次问过这个问题而且似乎没有人知道。我一直听到的所有反复试验都是真的吗?没有地方可以学习如何编写代码?我注定要失败:o)

I have a very easy one for you guys:

I have a checkbox that is called [ProjectDetailActive]
it''s default value is "true"

I would like to insert a code that would make it impossible to turn the checkbox to false if another field on the same form[ProjectDetailEndDate] = null

A side Comment:
I don''t know how you guys manage to find the correct statement for these codes. Where do you guys learn this stuff? I''ve read articles, books, visited web sites but nowhere yet in two years have I found a place that teach how to write codes - they only give you an examples on how a code might read for a function that I would never use in a million year and never close to what I need. is there like a secret Harry Potter school where they do teach you how to write codes?

I''ve asked this question hundreds of times all over the internet and nobody seem to know. All trial and error I hear all the time- is that true? there is nowhere to learn how to write codes? I''m doomed :o)

推荐答案

嗨jaad,


我建议使用After Update事件< b> ProjectDetailEndDate 与Enabled结合使用 ProjectDetailActive 的属性。特别是,您可以在After Update事件中执行If测试,并将复选框Enabled属性设置为true或false,具体取决于测试结果。


在学习方面如何编码......你通过自己教授一般原则来学习,然后将这些原则应用到你的特定问题中,通常包含反复试验。如果您寻找解决问题的确切代码的信息来源,您的搜索几乎总是徒劳无功。


Pat
Hi jaad,

I would suggest using the After Update event for ProjectDetailEndDate in conjunction with the "Enabled" property for ProjectDetailActive. In particular, you can perform an If test inside the After Update event and set the checkbox Enabled property to true or false depending on what the result of the test is.

In terms of learning how to code...you learn by teaching yourself general principles, and then applying those principles to your particular problem, often incorporating trial and error. If you go to sources of information looking for the exact code to solve your problem, your search will almost always be futile.

Pat


这是我从You tube视频中获取的代码,并根据我的需要调整它。

This is the code that I''ve picked up from a You tube video and adapted it to my need.

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


尝试使用它时会发生什么?它会产生错误吗?有某种奇怪的行为吗?你需要更清楚地解释发生了什么。


Pat
What happens when you try to use it? Does it produce an error? Is there some sort of strange behavior? You need to explain more clearly what''s happening.

Pat


这篇关于如果声明问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆