首页 \ 问答 \ 单击提交按钮,将值从一个文本框填充到另一个文本框(Populate value from one textbox to another on clicking on submit button)

单击提交按钮,将值从一个文本框填充到另一个文本框(Populate value from one textbox to another on clicking on submit button)

我有2个文本框和一个提交按钮。单击提交按钮,第一个文本框中的值应填入第二个文本框。您可以帮助我。 先谢谢你。


I have 2 text boxes and a submit button.On clicking on the submit button the value from the first textbox should get populated in the second textbox.Can you help me with this. Thankyou in advance.


原文:https://stackoverflow.com/questions/2583973
更新时间:2024-05-01 10:05

最满意答案

在我的问题评论的帮助下,我自己找到了anwser:错误在代码中已经过去了。 价值的加速是问题所在。 在那里,我做了一个超出绑定访问的数组,似乎当if条件中的两个语句都相同时,编译器会优化它。

这个:

...
int value = stupidArray[wrongIndex];

if( value == 0 )
{
  result = make_float4(0,0,1,0.01);
}
else
{
  result = make_float4(0,0,1,0.01);
}
...

优化到这个:

...
result = make_float4(0,0,1,0.01);
...

所以在这种情况下没有产生错误。


I found the anwser by myself with the help of the comments on my question: The error was way before in the code. The calcutation of value was the problem. There, I did an array out of bound access and it seems that the compiler optimizes this away when both the statements in the if-condition are the same.

This:

...
int value = stupidArray[wrongIndex];

if( value == 0 )
{
  result = make_float4(0,0,1,0.01);
}
else
{
  result = make_float4(0,0,1,0.01);
}
...

was optimized to this:

...
result = make_float4(0,0,1,0.01);
...

and so in this case no error was generated.

相关问答

更多
  • 我认为这解决了我的问题: http://www.mathworks.de/matlabcentral/answers/45307 I think this solved my problem: http://www.mathworks.de/matlabcentral/answers/45307
  • 这可能导致崩溃的原因有很多。 按照您的代码顺序,或多或少: 你free str,然后对其进行扫描。 一旦释放内存,它就不再可用。 然后是scanf: scanf("%s", str) 。 一旦有人在控制台输入10个或更多字符的字符串,您就会输入未定义行为的领域,因为内存将被覆盖。 将str分配给refpoint ,反之亦然,应该为您提供大量的编译器警告。 你的一个变量是int ,另一个是char * 。 在某些体系结构中,指针不适合int ,并且一旦使用它,程序就会崩溃。 你的while循环增加str 。 ...
  • 一旦您丢失了应用程序层和数据库层之间的握手,您将在尝试从应用程序层终止数据库会话时遇到一些严重的困难。 使用提升的权限,您可以在查询V$SESSION视图并尝试查找挂起的会话时执行一些奇特的操作,以便您可以使用JDBC发送一些kill命令(注意我可能因为我不能保证像存在于JDBC驱动程序中 - 事实上它可能不存在)。 但我认为这将是严重的矫枉过正。 我认为更好的选择是使用Oracle的会话管理工具从数据库端解决问题。 将您要连接的用户配置文件中的IDLE_TIME参数设置为UNLIMITED以外的其他参数, ...
  • 在我的问题评论的帮助下,我自己找到了anwser:错误在代码中已经过去了。 价值的加速是问题所在。 在那里,我做了一个超出绑定访问的数组,似乎当if条件中的两个语句都相同时,编译器会优化它。 这个: ... int value = stupidArray[wrongIndex]; if( value == 0 ) { result = make_float4(0,0,1,0.01); } else { result = make_float4(0,0,1,0.01); } ... 优化到这个: ...
  • 考虑到insertPlainText在当前光标位置插入文本,所以我认为如果没有设置光标(例如没有焦点),您可能会遇到问题。 你可以尝试: txt->setPlainText("your text"); 或者,如果想要追加: txt->setPlainText(txt->toPlainText() + "appended text"); Take into consideration that insertPlainText inserts text at current cursor position, ...
  • 你在这里做模数zero : if ( 130816 % number == 0 ) 这是未定义的行为。 如果你在1开始你的for循环,它应该解决这个问题。 但是,对于所有N ,因为N % 1 == 0 ,所以您可能需要从2开始。 从C99标准6.5.5 /5 (在C11不变): /运算符的结果是第一个操作数除以第二个操作数的商; %运算符的结果是余数。 在两种操作中,如果第二个操作数的值为零,则行为未定义。 You are doing modulus zero here: if ( 130816 % nu ...
  • 我假设你想知道为什么代码片段在你发布的链接中崩溃了。 问题出在这一行。 *(ptr - 1) = 'x'; // i.e. ptr[-1] = 'x'; 在执行ptr = malloc() ,执行上面的命令。 指针写入超出范围的存储区域; 这会导致未定义的行为。 幸运的是系统崩溃了。 I assume that you want to know why the code snippet is crashing in your posted link. The problem is in this line ...
  • 使用这个Main_Menu()方法而不是你的。 你会得到平稳的输出。 private void Main_Menu() { Console.WriteLine("1). Welcome"); Console.WriteLine("2). Help Facilities"); Console.WriteLine("3). Exit"); string userChoiceSTR = Con ...
  • 这可能是因为其他顶点数组仍然被启用,而OpenGL的指针尚未被清除,导致OpenGL取消引用悬空指针。 使用OpenGL Frame Debugger或glGetIntegerv()查看是否启用了任何其他数组类型(COLOR_ARRAY,NORMAL_ARRAY,GL_TEXTURE_COORD_ARRAY)。 This is likely because other vertex arrays are still enabled, while OpenGL's pointers to them haven ...
  • 你应该 增加size_ by +1也避免缓冲区溢出(或者,使用std::vector代替,见下文) 禁用复制构造/分配 添加一个适当的析构函数 使用初始化列表 检查声明成员的顺序(因为这也是成员初始化的顺序!) 删除默认构造函数,因为它不初始化单个成员 在现代编译器上包含而不是 (所以你得到命名空间C标准库函数) 考虑使用std::vector而不是手动数组。 这样可以省去很多麻烦。 想一想如何让构造函数异常安全? 以下是修复以上所有内容的示例: #include

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)