我正在尝试将一组四个单选按钮添加到表单中.还有其他单选按钮,所以我将它们放在Panel上进行分组.但是使用下面我只是将面板添加到没有单选按钮的表单中...我在这里做错了吗?
Dim arrRButton(3) As RadioButton
arrRButton(0) = New RadioButton
arrRButton(1) = New RadioButton
arrRButton(2) = New RadioButton
arrRButton(3) = New RadioButton
With arrRButton(0)
.AutoSize = True
.Checked = True
.Location = New System.Drawing.Point(77, 139)
.Name = "RadioButton5"
.Size = New System.Drawing.Size(55, 17)
.TabIndex = 48
.TabStop = True
.Text = "NEAR"
.UseVisualStyleBackColor = True
End With
'.... etc
'Panel2
Dim Panel2 As New Panel
With Panel2
.Controls.Add(arrRButton(0))
.Controls.Add(arrRButton(1))
.Controls.Add(arrRButton(2))
.Controls.Add(arrRButton(3))
.Location = New System.Drawing.Point(61, 130)
.Name = "Panel2"
.Size = …Run Code Online (Sandbox Code Playgroud) 使用以下代码(使用Moq 4.0.10501.6):
HomeController controller = new HomeController();
ActionResult result = _controller.Index();
Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();
Mock<HttpContextBase> httpContext = new Mock<HttpContextBase>();
httpContext.Setup(x => x.Response).Returns(response.Object);
Mock<ControllerContext> controllerContext = new Mock<ControllerContext>();
controllerContext.Setup(c => c.HttpContext).Returns(httpContext.Object);
result.ExecuteResult(controllerContext.Object);
Run Code Online (Sandbox Code Playgroud)
...我得到以下编译器错误:
error CS1502: The best overloaded method match for
'Moq.Language.IReturns<System.Web.Mvc.ControllerContext,
System.Web.HttpContextBase>.Returns(System.Web.HttpContextBase)'
has some invalid arguments
error CS1503: Argument 1: cannot convert from 'System.Web.HttpContextBase
[c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\
v4.0\System.Web.dll]' to 'System.Web.HttpContextBase'
Run Code Online (Sandbox Code Playgroud)
我做错了什么?为什么我不能转换HttpContextBase为HttpContextBase?
我从一个ASP.NET MVC项目开始,添加了一个NUnit测试项目,ReSharper整理了缺少的System.Web参考.根据VS中的属性窗口,我正在引用的System.Web.dll是其中的一个C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll.
我正在与谷歌博彩公司合作,它返回16位数的时间戳,我似乎无法在C#中识别出变成真实日期,任何想法?
如何将此时间戳:1278276905502403转换为C#中有意义的内容?
我是javascript的新手,我可能咬的比我可以咀嚼的多,但我试图在我的Rails网站上运行jQuery autcomplete小部件.
我有一个名为"链接"的页面,我希望能够将一个人分配给一个链接.使用自动填充我应该能够有一个文本框,其中包含自动填充建议的人名列表,选中后,人名仍保留在文本框中.但是当提交表单时,我不希望随表单一起发送的人名,我希望随表单发送的人员ID.
所以问题是如何选择人名,保留在文本框中,但一旦提交,则提交人员ID.
在Rails中,这是我从Person控制器提供JSON数据的方式:
def index
if params[:term]
@people = Person.find(:all,:conditions => ['given_name LIKE ?', "#{params[:term]}%"], :limit => 5)
else
@people = Person.all
end
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @people.to_json(:only => [:id, :given_name]) }
end
end
Run Code Online (Sandbox Code Playgroud)
以上输出以下JSON文本:
[{"person":{"id":1,"given_name":"dale"}},{"person":{"id":2,"given_name":"sally"}},{"person":{"id":3,"given_name":"joe"}}]
Run Code Online (Sandbox Code Playgroud)
使用jQuery自动完成插件,如何在建议的匹配中显示'given_name',选择后在文本框中保留'given_name',但在提交表单时发送'id'值.
我想我需要在javascript中指定要标记的内容以及要发送的值.因为我刚刚掌握了javascript,如果你能解释你的答案是如何工作的,那将是值得赞赏的.谢谢.
我需要得到像192这样的计算机的本地IP.*....这可能用PHP吗?
我需要运行脚本的系统的IP地址,但我不需要外部IP,我需要他的本地网卡地址.
我在android webview上绘制了一些画布图,并使用javascript来隐藏和显示更改图表,并通过重置其innerHTML来更改标题.
标题只是一个普通的html标签 "<div id='title'></div>",
例如,当我切换图表时,页面无法很好地呈现.当我选择显示下一个图表并更改标题的innerHTML时,标题似乎"记住"了它之前的innerHTML,它看起来像一个文本重叠另一个.
如果我手动更改手机的方向,似乎让webview重绘其内容(不刷新),那么一切都会好的.
有什么想法吗?或者我可以模拟方向更改事件以使我的webview重绘其页面以解决它?
我是使用脚本语言的新手.我遇到了两种称为Perl和Bash shell脚本的脚本语言.
我想知道使用Perl脚本可以完成哪些事情但是无法使用Bash shell脚本完成?
谢谢.
如果我有一个数组a:
a[a.length]回报nil.好.a[a.length, x]回报[].好.a[a.length+x, y]回报nil.与2不一致.虽然这种行为被记录在案,这似乎很奇怪.
任何人都可以解释这种设计背后的原因吗?
我正在尝试学习C++,在这个过程中我试图编写一个函数,它获取两个char指针并将第二个连接到第一个(我知道有strcat这个).
但是 - 我想要完成的是修改第一个参数指针,使其指向结果.因此我在第一个参数中使用了对指针的引用.
在从函数返回之前我想释放第一个参数内存,但是我收到一个错误.
这是代码:
void str_cat(char*& str1, char* str2)
{
if (!str1)
{
str1 = str2;
return;
}
if (!str2)
return;
char * new_data = new char[strlen(str1) + strlen(str2) +1];
char * new_data_index = new_data;
char * str1_index = str1;
char * str2_index = str2;
while(*str1_index)
*new_data_index++ = *str1_index++;
while(*str2_index)
*new_data_index++ = *str2_index++;
*new_data_index = NULL;
delete str1; //ERROR HERE (I also tried delete[] str1)
str1 = new_data;
}
Run Code Online (Sandbox Code Playgroud)
我不懂为什么.
有什么建议?
谢谢,
Itay \
编辑 以下是我如何使用该功能 …
我有一个多行EditText:
<EditText
android:layout_gravity="center"
android:id="@+id/txtMessage"
android:layout_height="wrap_content"
android:layout_below="@+id/lblMessage"
android:layout_width="wrap_content"
android:width="250dip"
android:text=""
android:maxLength="760"
android:lines="4">
</EditText>
Run Code Online (Sandbox Code Playgroud)
现在内容与中间对齐.我希望将内容与顶部对齐如下:
垂直对齐的文本示例http://img28.imageshack.us/img28/3972/edittext.png
有没有财产可以做到这一点?