我正在使用Windows窗体应用程序.我有三个按钮.我写了计算每个按钮的新位置的方法.但我有一些错误(代码后解释).方法是:
Random random = new Random();
public int SetPointLocation()
{
int x1 = x2 - 20;
int x2;
int x3 = x2 + 20;
int y1 = y2 - 1;
int y2 = random.Next(0, 2);
int y3 = y2 + 1;
return x2 = (((x3 - x1) * (y2 - y1)) / y3 - y1) + x1;
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
在声明之前不能使用局部变量'x2'.
在声明之前不能使用局部变量'y2'.
所以我重新安排了方法的块:
Random random = new Random();
public int SetPointLocation()
{
int x2;
int x1 = x2 - 20;
int …Run Code Online (Sandbox Code Playgroud) 不知道如何做到这一点否则......但这就是我想要做的:
我有一系列的收音机盒
<div id="xrowcont_0">
<input type="radio" name="13_641" value="a" id="13_641_form_a" ><label for="13_641_form_a"><span></span></label>
<input type="radio" name="13_641" value="b" id="13_641_form_b" checked="checked"><label for="13_641_form_b"><span></span></label>
<div id="xmod_mach_list_0" style="display:none;">BOO1</div>
</div>
<div id="xrowcont_1">
<input type="radio" name="13_642" value="a" id="13_642_form_a"><label for="13_642_form_a"><span></span></label>
<input type="radio" name="13_642" value="b" id="13_642_form_b"><label for="13_642_form_b"><span></span></label>
<div id="xmod_mach_list_1" style="display:none;">BOO2</div>
</div>
... ++++
Run Code Online (Sandbox Code Playgroud)
并且想法是当你在中选择单选框"B"时<div id="xrowcont_0">,它会<div id="xmod_mach_list_1"在每行旁边取消隐藏.
这是js:
可以说我们有13排......
for (var i=0;i<13;i++) {
var a1 = "'#xrowcont_" + [i] + " input[type=radio]'";
var a2 = "'#xrowcont_" + [i] + " input:checked'";
console.log(a1);
console.log(a2); // these show up just …Run Code Online (Sandbox Code Playgroud) 我有一张桌子.我想在此表中添加两列.
我试过这样的:
SELECT *
into
dbo.mytable_Audit
from dbo.mytable
Run Code Online (Sandbox Code Playgroud)
但是,我需要两个colums到mytable_Audit,如何在sybase 15-2 ASE中添加它们?
我正在使用Sharepoint中的一小段代码,如下所示:
int? do_ = (int?)re["mi"]; // consider "re" a dictionary<string, object>;
Run Code Online (Sandbox Code Playgroud)
等号右边的表达式求值为a Double.为了double确保,我double在监视窗口中检查它(:D).是的,它是一个System.Double进出的.
但是,该行抛出异常:
指定演员表无效.
当我明白是的时候,我正准备用我的额头在我的桌子上留下凹痕,是的,你可以将double转换为int,尽管丢失了值的非整数部分(实际上是在我的情况下).在世界开始之前,我在编程的第一天就学到了这一点.
所以为了更加确定,我创建了另一个解决方案,一个简单的控制台应用程序.我把这段代码放进去了:
double dragon = 2.0;
int? i = (int?)dragon;
Run Code Online (Sandbox Code Playgroud)
它的工作原理与预期一致.
为什么它会在一个设置中工作但在另一个设置中失败?